Output command question Topic is solved

Get help with using AutoHotkey and its commands and hotkeys

Output command question  Topic is solved

06 Dec 2015, 10:14

Hi guys,

I have tried to search for this answer as far as I was able because it seems fairly basic to me but to no avail. I need an output command that will function similar to the 'Send' command but will print the value of a object in a list. Basic structure of what I need to do looks something like this:

colours := Object("red", "blue", "green")

for x in colours

Send x


Needing the output to be:


I am managing to do this with the MsgBox command so my code is working fine, but I need this to type into something like notepad. I can't manage to use the Send command for this successfully. What other output command can I use, or how do I need to phrase the Send command for this to work?

Thank you in advance

Re: Output command question

06 Dec 2015, 10:23

Well as it turns out I managed to figure out the answer minutes after posting this even though I've been searching for weeks.

The answer for anyone else who ever ends up sitting with a similar problem is simply adding the % annotation as in "Send %x%", this lets the program know to see it as the variable and not the value you are typing there.

Do topics get closed after they are solved ?
Posts: 47
Joined: 07 Nov 2015, 22:50

Re: Output command question

06 Dec 2015, 12:08

You can also use,

Code: Select all

Send, % x
Note the space after "%" which makes everything following it "evaluated" instead of "as is". Particularly helpful for arrays. These two msgbox's have the same result:

Code: Select all

x := "Blue"
y := "Yellow"
Msgbox, %x% is my colour. %y% is another colour.
Msgbox, % x " is my colour. " y " is another colour."

colours := ["red", "blue", "green"]

msgbox, % colours[1] " works just fine"
; msgbox, %colours[1]% 			; can't do this
msgbox, %colours%[1] 			; not particularly helpful
Do topics get closed after they are solved ?
Don't think so, but a moderator would know better. It would be nice if topics were flagged "answered" in the list, or even better had an answer "rating" ("being discussed", "suggestion", "amateur answer", "solved", "professional answer"...that sort of thing.)

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], boiler, Chunjee, Google [Bot], Hologram, mikeyww and 44 guests