Source language: Translate to:

Requesting Help With Expiration Date Script

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Requesting Help With Expiration Date Script

Postby Victor1000 » Wed Apr 29, 2015 10:06 am

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"
Victor1000
 
Posts: 2
Joined: Mon Apr 13, 2015 2:10 pm

Re: Requesting Help With Expiration Date Script

Postby Neosoft Support » Wed Apr 29, 2015 10:24 am

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.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5602
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: Requesting Help With Expiration Date Script

Postby Victor1000 » Wed Apr 29, 2015 11:05 am

Thank you, Neobook Support.

I made a simple, embarrassing goof. :roll:

Of course your code correction works perfectly.

Victor
Victor1000
 
Posts: 2
Joined: Mon Apr 13, 2015 2:10 pm

Re: Requesting Help With Expiration Date Script

Postby Neosoft Support » Thu Apr 30, 2015 10:23 am

No problem. Glad to help.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5602
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest

cron