Application.SaveValue

Application.SaveValue ( 

string Section,

string Key,

string Value )

Example 1

Application.SaveValue("User Info", "First Name", first_name);

Saves the value that is currently in the variable "first_name" into a section called "User Info" and a key called "First Name".

Example 2

Application.SaveValue("Company", "Address", "123 Bannatyne Avenue");

Saves the value "123 Bannatyne Avenue" into the "Address" key of the "Company" section.

Example 3

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 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