OverviewExamples
first_name = Application.LoadValue("User Info", "First Name");
Loads the current value of the "First Name" key in the "User Info" section, and stores it in a variable called "first_name".
address = Application.LoadValue("Company", "Address");
Looks up the value of "Address" in the "Company" section, and stores it in a variable named "address".
user_name = "";
-- Loop until a valid user name is entered or the user cancels.
while (user_name == "") and (user_name ~= "CANCEL") do
--Prompt the user for their user name.
user_name = Dialog.Input("User Information", "Please enter your user name:", "", MB_ICONQUESTION);
-- If the user does not enter any text, display an error message. The loop will continue from the beginning.
if user_name == "" then
result = Dialog.Message("Error", "Your information could not be processed as entered. Please try again.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
-- If the user entered a valid user name and didn't cancel, store the value in the Registry.
elseif user_name ~= "CANCEL" then
Application.SaveValue("Your_User_Name", "Your_Key", user_name);
-- Check to see if there was an error saving.
error = Application.GetLastError();
end
end
-- If the user didn't cancel and there was no error saving,
-- Load the user name from the registry and display a welcome dialog.
if (user_name ~= "CANCEL") and (error == 0) then
loaded_username = Application.LoadValue("Your_User_Name", "Your_Key");
-- If the value loaded successfully.
if (Application.GetLastError() == 0) then
result = Dialog.Message("Hello", "Welcome "..loaded_username.."!", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end
end
Prompts the user for a user name using the Dialog.Input action and then saves the name in the Registry. The name is then loaded from the Registry and displayed in a dialog.
See also: Related Actions