| View previous topic :: View next topic |
| Author |
Message |
im a guest Guest
|
Posted: Thu Aug 16, 2007 2:00 pm Post subject: possible bug with One True Brace style |
|
|
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
|
Posted: Thu Aug 16, 2007 5:46 pm Post subject: Re: possible bug with One True Brace style |
|
|
| 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 |
|
 |
Roland
Joined: 08 Jun 2006 Posts: 244
|
Posted: Fri Aug 17, 2007 12:00 pm Post subject: |
|
|
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 |
|
 |
iamguest Guest
|
Posted: Fri Aug 17, 2007 11:59 pm Post subject: |
|
|
| thanks that worked |
|
| Back to top |
|
 |
|