Demorize Digital Signage Software

19.2.2. Demorize functions

In order to do some practical work in the scripts you have to communicate with the Demorize system. This is done through Demorize functions that are made available in the Lua language. This chapter list the functions that Demorize has provided to the language.

GX:Debug("Message")

Writes a text to the Demorize log file. This function can be used for debugging your scripts.

Arguments
  • Message - The message to print to the log.

Return

none

GX:Dec2Hex(Value)

Converts a value written in decimal form into a hexadecimal string representation.

Arguments
  • Value - The decimal value to convert.

Return

A hexadecimal representation of the value.

GX:Hex2Dec(Value)

Converts a value written in hexadecimal form into a decimal string representation.

Arguments
  • Value - The hexadecimal value to convert.

Return

A decimal representation of the value.

GX:FormatText("Text")

Returns a text where data source and variable references written in the input text are replaced with their current value.

Arguments
  • Text - A string that may contain references to data source items and variables within the written text.

Return

A string where references has been substituted with their current value.

GX:GetProperty(TargetObject, "Property")

Gets a reference to an object's property. This reference can later be used in calls to the GX:SetProperty* functions. See Section 19.3, “Object Property Script Names” for information about the names of the objects' properties that can be supplied as the Property parameter to this call.

Arguments
  • TargetObject - The object from which to get the property reference. This argument takes the value that is supplied to the script through the SetTarget function.
  • Property - The property to get a reference to.

Return

A reference to the object's property.

GX:GetPropertyValue(Property)

Gets the value of a given object property.

Arguments
  • Property - Reference to the property for which to get the value. This is a reference retrieved by a call to the GX:GetProperty function.

Return

The decimal value of the property.

GX:SetPropertyValue(Property, Value)

Sets the value of a given object property.

Arguments
  • Property - Reference to the property for which to set the value. This is a reference retrieved by a call to the GX:GetProperty function.
  • Value - The decimal value to set.

Return

none

GX:GetPropertyColor(Property)

Gets the color of a given object property. This function is used for properties that return color values.

Arguments
  • Property - Reference to the property for which to get the color. This is a reference retrieved by a call to the GX:GetProperty function.

Return

The color value of the property.

GX:SetPropertyColor(Property, Color)

Sets the color of a given object property.

Arguments
  • Property - Reference to the property for which to set the color. This is a reference retrieved by a call to the GX:GetProperty function.
  • Color - The color value to set.

Return

none

GX:GetDataSource(Name)

Gets the reference to a given data source.

Arguments
  • Name - The name of the data source.

Return

The data source reference.

GX:GetDataValue(DataSource, Item, Specifier)

Gets the value for a given data item.

Arguments
  • DataSource - The data source reference. This is a reference retrieved by a call to the GX:GetDataSource function.
  • Item - The data item.
  • Specifier - The data specifier or an empty string if not used.

Return

The data value.

GX:UpdateDataSource(DataSourceName, WaitUntilCompleted)

Trigger a content update of a data source.

Arguments
  • DataSourceName - The name of the data source to trigger and update for.
  • WaitUntilCompleted - Tells if the update operation shall wait for the update to complete before continuing or not.

Return

none

GX:GetContent(File)

Gets the content of a file.

Arguments
  • File - The file path.

Return

The file content as a string.

GX:Exists(Path)

Checks if a file or directory exists or not.

Arguments
  • Path - The path to check.

Return

true if the path exists, otherwise false.

GX:HttpGet(Url)

Makes a HTTP GET request to the given URL.

Arguments
  • Url - The URL string.

Return

The data returned in the HTTP response or nil if an error occurred.

GX:RestGet(Url)

Makes a REST API call to get data from a REST service.

Arguments
  • Url - The REST URL string.

Return

The data returned from the REST service or nil if an error occurred.

GX:RestPut(Url, Data)

Makes a REST API call to put data to a REST service.

Arguments
  • Url - The REST URL string.
  • Data - The data to send.

Return

none

GX:SetCredentials(Type)

Sets the authorization credentials to use.

Arguments
  • Type - The type of credentials.

Return

none

GX:GetScreenWidth()

Gets the width of the screen in the coordinate system as described in Section 15.2.2, “Screen Dimensions”.

Arguments

none

Return

The width of the screen area.

GX:GetScreenHeight()

Gets the height of the screen in the coordinate system as described in Section 15.2.2, “Screen Dimensions”.

Arguments

none

Return

The height of the screen area.

GX:IsTimelineRunning()

Tells if the timeline is in play mode or not. When a presentation is running, it is always in play mode, but in the editor it is not in play mode when the user is editing.

Arguments

none

Return

Returns True if the timeline is playing, or False if it is not.