 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Highly
Joined: 29 Aug 2009 Posts: 4
|
Posted: Sat Aug 29, 2009 1:18 am Post subject: Help with adding to Strings |
|
|
Hi, I've been using AHK and this community for quite some time and am asking for a bit of help.
Here's my problem; I have a string, and I want to add to that string. The string starts out as "a", and is supposed to add _Blue, _Green, _Red, _Yellow sequentially to the string(So it would eventually read, "_Blue_Blue_Red_Yellow_red" or something similar), but it's not working
Here's the code
| Code: | Seq = a
Loop
{
PixelGetColor, Blue, 367, 367 []
if (Blue = 0xFEEE7F){
Seq += _Blue
}
PixelGetColor, Red, 285, 285 []
if (Red = 0x8F8FF5){
Seq += _Red
}
PixelGetColor, Green, 285, 365 []
if (Green = 0x7CFFD7){
Seq += _Green
}
PixelGetColor, Yellow, 365, 285 []
if (Yellow = 0x9AFEFB){
Seq += _Yellow
}
GetKeyState, state, Shift
if state = D
MsgBox %Seq%
}
return |
FYI, Seq is supposed to be the string, and the "Seq += _Yellow" wtc, are where I want to add the words infront of the string.
I've spent a couple of hours going through the manual, and there's virtually nothing on handling strings. Thanks in advance. |
|
| Back to top |
|
 |
purloinedheart
Joined: 04 Apr 2008 Posts: 537 Location: Canada
|
Posted: Sat Aug 29, 2009 1:24 am Post subject: |
|
|
Hope that's what you are looking for |
|
| Back to top |
|
 |
Highly
Joined: 29 Aug 2009 Posts: 4
|
Posted: Sat Aug 29, 2009 1:26 am Post subject: |
|
|
| PurloinedHeart wrote: |
Hope that's what you are looking for |
I'm going to try this one out, but a little help as to what it does? |
|
| Back to top |
|
 |
horntail
Joined: 03 Aug 2009 Posts: 69 Location: UK
|
Posted: Sat Aug 29, 2009 1:31 am Post subject: |
|
|
| PurloinedHeart wrote: |
Hope that's what you are looking for |
nice edit there, i was just going to correct you PurloinedHeart
the .= means that the following will be added to the var, instead of replacing it |
|
| Back to top |
|
 |
Highly
Joined: 29 Aug 2009 Posts: 4
|
Posted: Sat Aug 29, 2009 1:37 am Post subject: |
|
|
| horntail wrote: | | PurloinedHeart wrote: |
Hope that's what you are looking for |
nice edit there, i was just going to correct you PurloinedHeart
the .= means that the following will be added to the var, instead of replacing it |
Ahh, thanks. I just added it into my script and it's working beautifully, thanks much, problem solved |
|
| Back to top |
|
 |
Guest
|
Posted: Sat Aug 29, 2009 1:40 am Post subject: |
|
|
| Highly wrote: |
I'm going to try this one out, but a little help as to what it does? |
What, did you not find the help file? It is there so you do not have to ask these kind of questions.
Look at topic Variables and Expressions. If you had read that, you would not have had to ask the first question.
| Quote: | | for example, Var //= 2 performs floor division to divide Var by 2, then stores the result back in Var. Similarly, Var .= "abc" is a shorthand way of writing Var := Var . "abc". |
|
|
| Back to top |
|
 |
Highly
Joined: 29 Aug 2009 Posts: 4
|
Posted: Sat Aug 29, 2009 1:44 am Post subject: |
|
|
| Anonymous wrote: | | Highly wrote: |
I'm going to try this one out, but a little help as to what it does? |
What, did you not find the help file? It is there so you do not have to ask these kind of questions.
Look at topic Variables and Expressions. If you had read that, you would not have had to ask the first question.
| Quote: | | for example, Var //= 2 performs floor division to divide Var by 2, then stores the result back in Var. Similarly, Var .= "abc" is a shorthand way of writing Var := Var . "abc". |
|
Sorry, I had read that and and did not understand it to be applicable to my situation, because I misread terminology etc. I read all of the help files including the word string in them, I guess it was just an error through my incompetence. Again, sorry |
|
| Back to top |
|
 |
jaco0646
Joined: 07 Oct 2006 Posts: 3113 Location: MN, USA
|
Posted: Sat Aug 29, 2009 2:02 am Post subject: |
|
|
| To be fair, there is an awful lot of information in that expression operators table; and I doubt anyone would grasp all of it in one reading. There is no need to apologize, that's what the help forum is here for. It was an honest question. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|