globalmapper.RunScript

globalmapper.RunScript(str aFilenameOrText, GM_LoadFlags_t32 aLoadFlags, int aReserved) GM_Error_t32, GM_LayerHandle_t32, uint32[source]

Runs a Global Mapper script (.gms) or workspace (.gmw). You can provide the filename of the script to run or you can provide script as raw text. Any layers loaded by the script will be returned as a pointer to an array of Layer Handles, and a uint32 will also be returned to specify the length of the array. Both will be 0 if no layers were loaded or created. Refer to the tutorial page on working with layer handles for more information on how to turn the array pointer into a usable object in Python.

Almost all of the functionalities in Global Mapper that don’t have a corresponding function call in the SDK can be accessed using RunScript. The complete list of scripts that can be performed by this function can be found here: https://www.bluemarblegeo.com/knowledgebase/global-mapper-22-1/Scripting_Reference/Global_Mapper_Scripting_Language.htm

Parameters
  • aFilenameOrText (str) – str with full path of script or the actual text of the script

  • aLoadFlags (GM_LoadFlags_t32) – Extra flags for load behavior

  • aReserved (int) – Reserved for future use; must be 0.

Returns

Error Code

Return type

GM_Error_t32

Returns

Pointer to array of layer handles loaded by the script

Return type

GM_LayerHandle_t32

Returns

Number of layer handles in the array

Return type

uint32