Page.GetObjectType

number Page.GetObjectType ( 

string ObjectName )

Example 1

what_type = Page.GetObjectType("MyVideo");

Gets the number representing the type of the "MyVideo" object and stores it in a variable called "what_type." If this object was a video object, the number 5 would be returned.

Example 2

-- Get the names of all of the objects on the page.
object_names = Page.EnumerateObjects();

-- Get the error code of the last action.
error = Application.GetLastError();

-- If an error occurred, display the error code message.
if (error ~= 0) then
    Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
else
    -- If there are no objects on the current page, display a dialog.
    if (object_names == nil) then
        Dialog.Message("Notice", "There are no objects on the current page.", MB_OK, MB_ICONEXCLAMATION);
    else
        -- Display the names of all of the label objects on the page.
        output_string = "";
        for index, object in pairs(object_names) do
            -- Get the type of the object
            type = Page.GetObjectType(object);
            if (type == OBJECT_LABEL) then
                output_string = output_string..object.."\r\n";
            end
        end
        Dialog.Message("Information", "Below are the names of all of the label objects on this page.\r\n\r\n"..output_string, MB_OK, MB_ICONINFORMATION)
    end
end

Gets the names of all of the objects on the current page and displays a dialog listing the names of only the label objects. If there are no objects on the page, or an error occurs, a notification dialog is displayed.

See also:  Related Actions