Page 1 of 1

Requesting Help With Expiration Date Script

PostPosted: Wed Apr 29, 2015 10:06 am
by Victor1000
Hi.

I have Neobook version 5.00 and I am trying to set up a routine that compares the current date to an expiration date, and then take appropriate actions.

I have placed the following code on the Startup Tab (under Book Properties > Actions).

Since the current date does exceed the specified expiration date (4-1-2015), it should generate the AlertBox and then exit the program.

It doesn't. Instead, it goes to Page 1.

What is wrong? I appreciate your help in resolving this. :D

Thank you.

Victor


First code tried:

.assign an Expiration Date for the Month, Day, and Year

DefineVar "[Month_To_Expire]" "Integer" "" "Global" "4"
DefineVar "[Day_To_Expire]" "Integer" "" "Global" "1"
DefineVar "[Year_To_Expire]" "Integer" "" "Global" "2015"

.code to verify that Neobook sees the current date (Month, Day, and Year) and the correct Expiration Date

.AlertBox "Answer" "Year: [Year]. Your Expiration Year: [Year_To_Expire]. Month: [MonthNum]. Your Expiration Month: [Month_To_Expire]. Day: [DayNum]. Your Expiration Day: [Day_To_Expire]."

.test if the Current Date equals or exceeds your Expiration Date; compare Year, Month, and Day independently

If "[Year]" ">=" "Year_To_Expire"
If "[MonthNum]" ">=" "Month_To_Expire"
If "[DayNum]" ">=" "Day_To_Expire"

.Expiration Date Has been reached or exceeded, so do the following actions

AlertBox "Evaluation Period Has Expired" "Your Evaluation Period has expired. Please contact the Owner to Purchase the Unlimited Version of This Program."

Exit "" ""

EndIf

EndIf

EndIf


.Expiration Date has NOT been reached, so do the following actions

GotoPage "1"


---------------------------------------------------------------------

Second code tried:

.assign an Expiration Date for the Month, Day, and Year

SetVar "Month_To_Expire" "4"
SetVar "Day_To_Expire" "1"
SetVar "Year_To_Expire" "2015"

.code to verify that Neobook sees the current date (Month, Day, and Year) and the correct Expiration Date

.AlertBox "Answer" "Year: [Year]. Your Expiration Year: [Year_To_Expire]. Month: [MonthNum]. Your Expiration Month: [Month_To_Expire]. Day: [DayNum]. Your Expiration Day: [Day_To_Expire]."

.test if the Current Date equals or exceeds your Expiration Date; compare Year, Month, and Day independently

If "[Year]" ">=" "Year_To_Expire"
If "[MonthNum]" ">=" "Month_To_Expire"
If "[DayNum]" ">=" "Day_To_Expire"

.Expiration Date Has been reached or exceeded, so do the following actions

AlertBox "Evaluation Period Has Expired" "Your Evaluation Period has expired. Please contact the Owner to Purchase the Unlimited Version of This Program."

Exit "" ""

EndIf

EndIf

EndIf


.Expiration Date has NOT been reached, so do the following actions

GotoPage "1"

Re: Requesting Help With Expiration Date Script

PostPosted: Wed Apr 29, 2015 10:24 am
by Neosoft Support
You just need to make sure that you always surround variables with square brackets [ ]. For example, the three If statements below:

If "[Year]" ">=" "Year_To_Expire"
If "[MonthNum]" ">=" "Month_To_Expire"
If "[DayNum]" ">=" "Day_To_Expire"

should be changed to"

If "[Year]" ">=" "[Year_To_Expire]"
If "[MonthNum]" ">=" "[Month_To_Expire]"
If "[DayNum]" ">=" "[Day_To_Expire]"

After that your code will work.

Re: Requesting Help With Expiration Date Script

PostPosted: Wed Apr 29, 2015 11:05 am
by Victor1000
Thank you, Neobook Support.

I made a simple, embarrassing goof. :roll:

Of course your code correction works perfectly.

Victor

Re: Requesting Help With Expiration Date Script

PostPosted: Thu Apr 30, 2015 10:23 am
by Neosoft Support
No problem. Glad to help.