Jump to content
Sign in to follow this  
IvanCodin

Test variable to macro

Recommended Posts

IvanCodin

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

EndIf

I get an expression error that point to the @YDAY macro.

Me

Share this post


Link to post
Share on other sites
Richard Robertson

Yes, macros can be used anywhere an expression can appear.

What does the error say exactly?

Share this post


Link to post
Share on other sites
IvanCodin

I get the follow error:

If @YDAY =< $lockdate Then

If ^ERROR

Error: Error in expression.

I checked and thought =< was a valid test. My syntax was wrong. I needed to use:

If @YDAY <= $lockdate Then

Thanks

Share this post


Link to post
Share on other sites
IvanCodin

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

Share this post


Link to post
Share on other sites
martin

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

This 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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.