DialogEx.GetObjectType

number DialogEx.GetObjectType (

string ObjectName )

Example 1

what_type = DialogEx.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 dialog.
object_names = DialogEx.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 dialog, display a dialog.
if (object_names == nil) then
Dialog.Message("Notice", "There are no objects on the current dialog.", MB_OK, MB_ICONEXCLAMATION);
else
-- Display the names of all of the label objects on the dialog.
output_string = "";
for index, object in pairs(object_names) do
-- Get the type of the object
type = DialogEx.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 dialog.\r\n\r\n"..output_string, MB_OK, MB_ICONINFORMATION)
end
end

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

See also: Related Actions