[Học phần mềm] AutoPlay 11 Đặt thời hạn sử dụng
admin
2021-03-15T14:31:13+07:00
2021-03-15T14:31:13+07:00
http://linhhoitrithuc.com/hoc-phan-mem-sang-tao/hoc-phan-mem-autoplay-11-dat-thoi-han-su-dung-329.html
/themes/vanhoa/images/no_image.gif
Chia sẻ tri thức - Vững bước tương lai
http://linhhoitrithuc.com/uploads/logo_1.png
11./ Đặt thời hạn sử dụng< Back – Mốt số ví dụA./ Đặt ngày hết hạn cho chương trìnhSau khi đặt thời hạn sử dụng, nếu đến ngày chỉ định sẽ hiện thông báo hết hạn và đóng chương trình - Nhấn Project > Actions > On Startup, nhập:
–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();
endB./ Đặt số lần sử dụng chương trìnhSau khi đặt số lần sử dụng, nếu vượt quá số lần qui định sẽ hiện thông báo hết hạn - Nhấn Project > Actions > On Startup
— Set the number of times allowed
times_allowed = 30;— Retrieve the number of times run and convert the value to a number
times_run = Application.LoadValue(“My Application”, “Has Been Run”);
times_run = String.ToNumber(times_run);— Calculate the number of allowed run times remaining
times_remaining = (times_allowed – times_run)— Check if this is the first time the application has been run
— Save the new number of times run value
if times_run == 0 then
Application.SaveValue(“My Application”, “Has Been Run”, “1”);
else
Application.SaveValue(“My Application”, “Has Been Run”, (times_run + 1));
end— Check if the application has been run more times than allowed
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.”);
endC./ Đặt thời hạn sử dụng là 3 ngày - Nhấn Project > Actions > On Startup, nhập:
— Initialize variables
days_left = 30;
date_installed = Application.LoadValue(“My Application”, “Date Installed”);
time_limit = 30; –the length of the trial period, in days— Convert string value to number
date_installed = String.ToNumber(date_installed);— Was date_installed 0 (non-existent)?
if date_installed == 0 then
— Value was nonexistent, create it
Application.SaveValue(“My Application”, “Date Installed”, System.GetDate(DATE_FMT_JULIAN));
else
— Update days_left
days_left = (date_installed + time_limit) – System.GetDate(DATE_FMT_JULIAN);
end— Are there days left?
if days_left < 1 then
— There are not any days left, alert user and exit.
Dialog.Message(“Trial Period Over”, “This software has expired”);
Application.Exit();
else
— There are days left, alert user how many
Dialog.Message(“Trial Period”, “You have “..days_left..” days left in your trial period.”);
end