Scripting on the Handheld WMS client
Scripting on the client is available with the 2024/04/08 release of the Handheld WMS client or later.
The following is a tutorial on client-side Handheld WMS scripting capabilities where certain areas have been opened to modification using scripts. Currently, LUA is the scripting language supported on the clients.
The advantage of client side scripting is the script is processed directly on the client with no need to return to the SYSPRO server. The disadvantage is there is no way to access the SYSPRO data from the client. The scripts are best used for simple checks or scanning manipulations.
Writing scripts
Any text editor can be used to write a script. The script file must be called "Scripts.txt" and be placed in the Handheld WMS resources folder on the SYSPRO server. The file is copied from the server to the clients when the "Update" screen is selected and the "Resources" option is checked. The script consists of one or more functions (described below).
For more information on LUA visit the main LUA documentation website or alternatively this LUA Tutorial.
Notes:
- There can be multiple functions in the same script file.
Currently the only active area for a client script is a scan modification. If there is a scan modification script any scans will be passed through the script before being processed.
The script always starts with the line
##ScriptArea
For scan processing the ScriptArea is "OnScan".
Following the ##ScriptArea is the script function followed by a script call. The client will replace #SCAN# in the script call with the scan being processed.
The following is a sample scan which will remove the first word in the scan.
##OnScan -- if more than one word in string, delete first word function delWord (s) I = string.find(s, ' ') if (I != nil) then return string.sub(s, I+1, string.len(s)) else return s end end return delWord('#SCAN#')