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 

IfGreater broken ?

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





PostPosted: Sun Jul 25, 2004 7:10 am    Post subject: IfGreater broken ? Reply with quote

I just installed ahk - Great product!!! Very Happy

Had a problem with some code .. looks like the following does not work:
ifGreater,var,10,var-+10

Syntax is OK, but it does not seem to decrement "var".
Here is the code I currently use (To circumvent the way I would like to
code it)

Code:

    ....
    SetTimer,MoveWin,150 ; Move the splash window fade slowly to the top left corner.



MoveWin:
   WinGetPos, X, Y, Width, Height, Clipboard
  ; IfGreater,X,10, X-=10 ; Does not work
  ; IfGreater,Y,10, Y-=10  ; Does not work..
   if X > 10
     EnvSub,X,10  ; This work OK..

   if Y > 10
     EnvSub,Y,10
   Width -=5
   Height -=5
   Transparancy-= 10
   WinMove, Clipboard,,%X%,%Y% ,%Width%, %Height%,  ,
   WinSet, transparent, %Transparancy%, Clipboard
   If X <=100
   {
      SplashTextOff
      ;;msgbox, Splash is gone!
      SetTimer,MoveWin,off
   }
   return
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Sun Jul 25, 2004 12:22 pm    Post subject: Reply with quote

Generally, you cannot use the legacy AutoIt v2 syntax together on the same line with a new syntax item. So either of these are okay, but not a mixture:
Code:
ifGreater,var,10,EnvSub,var,10
or
if var > 10
     var -= 10

One reason for this is ambiguity. The new syntax style allows scripts to use IfGreater and other similar commands with literal non-escaped commas in their second parameter as in this example:

ifGreater, var, 10, something+=
...

In the above, var is compared to the string "10, something+=", which although rare, is more flexible and might be relied upon occasionally by some scripts now.
Back to top
View user's profile Send private message Send e-mail
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