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:
red
blue
green
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
Charl
Output command question
Re: Output command question
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 ?
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: 52
- Joined: 07 Nov 2015, 22:50
Re: Output command question
You can also use,
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
Send, % x
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
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.)Do topics get closed after they are solved ?