AutoHotkey Community

It is currently May 26th, 2012, 8:47 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: August 29th, 2009, 2:18 am 
Offline

Joined: August 29th, 2009, 2:10 am
Posts: 4
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 29th, 2009, 2:24 am 
Offline

Joined: April 4th, 2008, 8:15 pm
Posts: 538
Location: Canada
Code:
Var .= "String"


Hope that's what you are looking for


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 29th, 2009, 2:26 am 
Offline

Joined: August 29th, 2009, 2:10 am
Posts: 4
PurloinedHeart wrote:
Code:
Var .= "String"


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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 29th, 2009, 2:31 am 
Offline

Joined: August 3rd, 2009, 4:44 pm
Posts: 69
Location: UK
PurloinedHeart wrote:
Code:
Var .= "String"


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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 29th, 2009, 2:37 am 
Offline

Joined: August 29th, 2009, 2:10 am
Posts: 4
horntail wrote:
PurloinedHeart wrote:
Code:
Var .= "String"


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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 29th, 2009, 2:40 am 
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".


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 29th, 2009, 2:44 am 
Offline

Joined: August 29th, 2009, 2:10 am
Posts: 4
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 29th, 2009, 3:02 am 
Offline

Joined: October 7th, 2006, 4:50 pm
Posts: 3157
Location: MN, USA
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: coinman, Google [Bot], joetazz, Leef_me, tidbit, Yahoo [Bot] and 63 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group