Is there a simple way to copy a List's contents

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
jwahk
Posts: 7
Joined: 18 Jul 2017, 06:55

Is there a simple way to copy a List's contents

21 Jul 2017, 13:30

WinGet, NewIDs, List
OldIds := NewIds
Msgbox % OldIds1
Msgbox % NewIds1
return

First Msgbox is empty
Second has window's id

Need to know how to make a copy of NewIds contents to OldIds without having to loop through NewIds if that is possible.
Last edited by jwahk on 21 Jul 2017, 13:57, edited 1 time in total.
Guest

Re: How do I copy an array

21 Jul 2017, 13:55

Its not a real array but a list of sequentially named variables, you might as well call the WinGet line again but if you must copy it this should do it

Code: Select all

WinGet, NewIDs, List
Loop, % NewIDs
	OldIds%A_Index%:=NewIds%A_Index%
Msgbox % OldIds1
Msgbox % NewIds1 ; a real array would be called like so: NewIds[1]
return
jwahk
Posts: 7
Joined: 18 Jul 2017, 06:55

Re: How do I copy an array

21 Jul 2017, 14:00

Guest wrote:Its not a real array but a list of sequentially named variables, you might as well call the WinGet line again but if you must copy it this should do it

Code: Select all

WinGet, NewIDs, List
Loop, % NewIDs
	OldIds%A_Index%:=NewIds%A_Index%
Msgbox % OldIds1
Msgbox % NewIds1 ; a real array would be called like so: NewIds[1]
return
Thank you. I was hoping there was a simpler way than doing a loop like x := y.
User avatar
tank
Posts: 3122
Joined: 28 Sep 2013, 22:15
Location: CarrolltonTX
Contact:

Re: Is there a simple way to copy a List's contents

21 Jul 2017, 14:53

I think your missing the point of what guest was trying to explain.NewIDs contains nothing
NewIDs1 does its a separat variable for each item in the list
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: peter_ahk, Ragnar, septrinus, yuu453 and 310 guests