How do I...?

Expire my Application After a Certain Date

To make your application expire after a certain date, set a variable in your program to the expiry date, and every time the program is run, check the current date against that value.  If your program is expired, it will close.

To accomplish this:

  1. Insert the following code into the On Startup event of your project:

--Input your expiration date here, format YYYYMMDD
--(no spaces, dashes, slashes, etc. just use numbers)
--Below is the date Dec 12, 2003
Expiration_Date = "20031212"

--Get the system date in ISO format
--Date = YYYY-MM-DD
Date = System.GetDate(DATE_FMT_ISO);

--Remove the dashes in the ISO format date
--to reflect the format of our expiry date
--Date == YYYYMMDD
Date = String.Replace(Date, "-", "", false);

--test to see if the application is expired
if Date > Expiration_Date then
    --The application has expired
    Dialog.Message ("Application Expired!", "Your copy of this application has expired!   This program will now exit.");
    Application.Exit();
end