I have tested a script to send different values to different places in an program.
I tried "text" from commands and it used "SendRaw" in the script. If "a" is set to a single value the script works. However the result produced exactly as a[1] not 1800 as intended. I also tried %a[1]% but it still does not work.
What is the correct way to do it? I just want be able to type all the values once in the beginning of the script as a single array.
a := [1800,1750,1700]
...
SendRaw, a[1]
...
SendRaw, a[2]
How to send values stored in an arrary?
Moderator: Pulover
Re: How to send values stored in an arrary?
Are you really using Pulover’s Macro Creator (where you posted)? This seems more like a question about actual AHK v1 code, but I don’t know much about PMC, so maybe it’s a valid question about PMC as well. I can move the thread to the proper section if it’s in the PMC area by mistake.
The answer to your question (probably even for PMC) is to force an expression because array elements can’t be used with legacy syntax — only expressions:
Switch to v2 if you want to avoid all the dual syntax confusion.
It’s better and easier to enumerate the array with a for loop rather than typing out each element:
The answer to your question (probably even for PMC) is to force an expression because array elements can’t be used with legacy syntax — only expressions:
Code: Select all
SendRaw, % a[1]
Switch to v2 if you want to avoid all the dual syntax confusion.
It’s better and easier to enumerate the array with a for loop rather than typing out each element:
Code: Select all
a := [1800,1750,1700]
for key, value in a
SendRaw, % value
Re: How to send values stored in an arrary?
Thanks. Good to know it needs to be % a[1] not %a[1] or %a[1]%. I am using PMC v5.4.1.
Return to “Pulovers Macro Creator”
Who is online
Users browsing this forum: No registered users and 8 guests