NyanSoldier
NyanSoldier

Reputation: 1

How to copy massive data to clipboard

I have an array [1, 2, 56, 32, 54] or something.

How do i send it to clipboard

1 2 56 32 54

I tried this.

Loop % table.MaxIndex() {
    meow := table[A_Index]
    Clipboard := meow"`r"
}

Upvotes: -4

Views: 62

Answers (1)

Onimuru
Onimuru

Reputation: 1

table := [1,2,3,4,5,6,7,8,9]

vClipboard := ClipboardAll
Clipboard := ""

Loop, % table.Count()
    string := string ? string . ", " . table[A_Index] : table[A_Index]

Clipboard := string

;Do some stuff.

Clipboard := vClipboard ;Restore the Clipboard.

Your problem was trying to loop with table.MaxIndex() which will potentially give you an unexpected amount since you can have an array with 2 values but very far apart in terms of Index i.e.

table := [1]
table[93] := "String"

and also each loop was overwriting your meow value. The method you want to use is concatenate i.e.

meow := "Hello"
meow := meow . "World" or meow .= "World"

Upvotes: 0

Related Questions