IvanCodin Posted December 26, 2007 Share Posted December 26, 2007 I can not get this to function. Can a macro be tested in an if statement like below:$lockdate = "365" ; Use 90, 180, 270, 365 (assume no leap year)MsgBox(0,"Info", "Lockdate is " & $lockdate & @CRLF & "Today is " & @YDAY, 5) If @YDAY > $lockdate Then MsgBox(0,"Info", "OK", "Good") Else MsgBox(0,"Error", "Application has Expired", "Goodbye!!", 5) Exit EndIfI get an expression error that point to the @YDAY macro.Me Link to comment Share on other sites More sharing options...
Richard Robertson Posted December 26, 2007 Share Posted December 26, 2007 Yes, macros can be used anywhere an expression can appear.What does the error say exactly? Link to comment Share on other sites More sharing options...
IvanCodin Posted December 26, 2007 Author Share Posted December 26, 2007 I get the follow error:If @YDAY =< $lockdate ThenIf ^ERRORError: Error in expression.I checked and thought =< was a valid test. My syntax was wrong. I needed to use:If @YDAY <= $lockdate ThenThanks Link to comment Share on other sites More sharing options...
IvanCodin Posted December 26, 2007 Author Share Posted December 26, 2007 My test always show the application has failed. Is @YDAY and $lockdate considered integers and can therefore be compared? $lockdate = "360" ; Use 90, 180, 270, 365 (assume no leap year) MsgBox(0,"Info", "Lockdate is " & $lockdate & @CRLF & "Today is " & @YDAY, 5) If @YDAY >= $lockdate Then MsgBox(0,"Info", "test", "Goodbye!!") Else MsgBox(0,"Error", "Application has Expired", "Goodbye!!") Exit EndIf CC Link to comment Share on other sites More sharing options...
martin Posted December 26, 2007 Share Posted December 26, 2007 My test always show the application has failed. Is @YDAY and $lockdate considered integers and can therefore be compared? $lockdate = "360" ; Use 90, 180, 270, 365 (assume no leap year)MsgBox(0,"Info", "Lockdate is " & $lockdate & @CRLF & "Today is " & @YDAY, 5) If @YDAY >= $lockdate Then MsgBox(0,"Info", "test", "Goodbye!!") Else MsgBox(0,"Error", "Application has Expired", "Goodbye!!") Exit EndIfCCThis works for me, but you have the forth parameter in the msgbox calls as a string but it should be an integer for the time out. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now