Setting my Application to Expire After a Certain Number of Executions
Document ID: IR10062The information in this article applies to:
- AutoPlay Media Studio 5.0 Standard Edition
- AutoPlay Media Studio 5.0 Professional Edition
SUMMARY
This article describes how to set your application to expire after a certain amount of executions.
DISCUSSION
To make your application expire after a certain number of executions, store a value in the registry the first time the program is run, and increment it every consecutive time the program is run. Then, every time the program is run, check the stored value.
To accomplish this, insert the following code into the On Startup event of your project:
times_allowed = 30;
times_run = Application.LoadValue("My Application", "Has Been Run");
times_run = String.ToNumber(times_run);
times_remaining = (times_allowed - times_run)
if times_run == "" then
Application.SaveValue("My Application", "Has Been Run", "1");
else
Application.SaveValue("My Application", "Has Been Run", (times_run + 1));
end
if times_run >times_allowed then
Dialog.Message("Trial Period Over", "This software has expired");
Application.Exit();
else
Dialog.Message("Trial Period", "You can run this program "..times_remaining.." more times.");
end
MORE INFORMATION
For more information please see the following topics in the AutoPlay Media Studio 5.0 help file:
- Program Reference | Actions | Application | Application.LoadValue
- Program Reference | Actions | Application | Application.SaveValue
- Program Reference | Actions | System | System.GetDate
KEYWORDS: AutoPlay Media Studio 5.0, Expire, Trial, Version, Executions
Last reviewed: October 1, 2003
Copyright © 2003 Indigo Rose Corporation. All rights reserved.