We strongly recommend that you use SAP GUI scripting in read-only mode. This can be achieved by following the Security Guide of SAP GUI as follows:
sapgui/user_scripting_set_readonly
While using SAP GUI scripting in read-only mode, only a subset of the API can be used from a script. This comprises read access to properties and calling read-only functions.