AutoHotkey Community

It is currently May 27th, 2012, 12:36 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: December 17th, 2009, 10:47 am 
i can't understand why this is happening

Code:
  Loop, Parse, mylist, `,
  {
    if move = hello
      msgbox zxzcvzxvcz
    if (move = hello) {
      msgbox qwerqwer
      ;more code..
  }


why am i only seeing the first msgbox?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 10:51 am 
Offline

Joined: April 15th, 2009, 12:05 am
Posts: 75
Location: Italy
because that's how the "IF (expression)" command syntax works..
you should en-close the expression in parenthesis (or round brackets, however you wanna call 'em) unless...
look here

_________________
Intel Centrino @ 2.8GHz
4 GB RAM
WIN XP SP3


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 10:56 am 
i dont follow sir

how is my expression not TRUE?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 11:11 am 
ok the problem is how i'm assigning the variable

apparently quotes throw everything off

can someone explain this to me? i'm using the assignment operator
http://www.autohotkey.com/docs/commands ... ession.htm

Code:

ss := "hi"

f1::
  msgbox %hi%     ; hi as expected
  if ss=hi
    msgbox this works
  if (ss=hi)
    msgbox this doesnt
return



Code:
ss := hi

f1::
  msgbox %hi%     ; empty wtf
  if ss=hi
    msgbox this doesnt
  if (ss=hi)
    msgbox this works
return



whats going on here? what is getting stored in the 2nd example?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 11:16 am 
guest3456 wrote:
i dont follow sir

how is my expression not TRUE?

No, it is not.
Code:
  Loop, Parse, mylist, `,
  {
    if move = hello
      msgbox zxzcvzxvcz
    if (move = "hello") { ; notice the quotes around LITERAL TEXT IN AN EPRESSION
      msgbox qwerqwer
      ;more code..
  }

An explanation and many examples are provided here: AutoHotkey Expression Examples: "" %% () and all that . Section H expressly applies to your mis-understanding.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 11:20 am 
ahhh
ty sir, i will understand it now


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: iDrug, Leef_me, Ohnitiel, rjgatito, Yahoo [Bot] and 20 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