Page.GetObjectScript

string Page.GetObjectScript ( 

string ObjectName,

string EventName )

Example 1

-- Get the script from the button's on click event
sScript = Page.GetObjectScript("Button1", "On Click");

-- get the last error code (or success code)
err = Application.GetLastError();

if err ~= 0 then
 -- An error occurred
    Dialog.Message(err, _tblErrorMessages[err]);
else
 -- No error, display output
    Dialog.Message("Script from On Click", sScript);
end

Gets the script from the On Click event of the button object "Button1" and outputs it to the user. If an error occurs, the user is notified.

Example 2

-- Get the script from the button's on click event
sPreviousScript = Page.GetObjectScript("Button1", "On Click");

-- Initialize the new script
sNewScript = "Dialog.Message(\"Title\", \"Message\");"

-- Append the new script to the old script
Page.SetObjectScript("Button1", "On Click", sPreviousScript .. "\r\n" .. sNewScript);

Appends a dialog message action to the script existing on the On Click event of the "Button1" button object.

See also:  Related Actions