AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

possible bug with One True Brace style

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
im a guest
Guest





PostPosted: Thu Aug 16, 2007 2:00 pm    Post subject: possible bug with One True Brace style Reply with quote

The helpfile says OTB style works with expression style if statements, however, when the expression contains a %variable% OTB style doesn't work.

here is the code that works
Code:
          If wa%A_Index%=%selectedwin%
            {
            newmanwind=%newmanwind%
            Continue
         }


these did not work
Code:
          If (wa%A_Index%=%selectedwin%) {
            newmanwind=%newmanwind%
            Continue
              }


         If wa%A_Index%=%selectedwin% {
            newmanwind=%newmanwind%
            Continue
         }
Back to top
engunneer



Joined: 30 Aug 2005
Posts: 6772
Location: Pacific Northwest, US

PostPosted: Thu Aug 16, 2007 5:46 pm    Post subject: Re: possible bug with One True Brace style Reply with quote

im a guest wrote:

these did not work
Code:
          If (wa%A_Index%=%selectedwin%) {
            newmanwind=%newmanwind%
            Continue
              }


         If wa%A_Index%=%selectedwin% {
            newmanwind=%newmanwind%
            Continue
         }


The second one is not an expression style if statement. to be an expression If, it must have parentheses, like your first one. However, your first one probably doesn't work because of the % on selectedwin
Try:


Code:

          If (wa%A_Index%=selectedwin) {
            newmanwind=%newmanwind%
            Continue
              }

_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
Roland



Joined: 08 Jun 2006
Posts: 244

PostPosted: Fri Aug 17, 2007 12:00 pm    Post subject: Reply with quote

Yeah, I think engunner's right, you're probably confused about what the % signs will do in an expression.

Here's an example:

Code:

var:="someOtherVar"
someOtherVar:=100
x1:=100
y:=1

if ( x%y%=%var% ) {
    msgbox okay
  }


Here var contains 'someOtherVar', which in turn contains 100, so in the expression %var% resolves to 100.
Back to top
View user's profile Send private message
iamguest
Guest





PostPosted: Fri Aug 17, 2007 11:59 pm    Post subject: Reply with quote

thanks that worked
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group