Passing command-line parameters to panels


When a panel file is double-clicked in Windows, it’s run by the the Helm Runtime application and the panel file name is passed as a parameter. So, double-clicking on “mypanel.helm” is the same as typing the following command line:

C:\> c:\Program Files\Rascular\Helm\Helm_RT.exe "mypanel.helm"

Up to four additional parameters can be passed on the command line, and they are loaded into the Root Panel properties Param_1, Param_2, Param_3 and Param_4.

These properties can then be queried from scripts to modify the panel’s behaviour depending on the parameters passed in.

--lua

if helm.get("RootPanel", "Param_1") == "debug" then
  helm.set("DebugLabel","Visible", true)
end

C:\> c:\Program Files\Rascular\Helm\Helm_RT.exe “mypanel.helm” debug

This technique is useful when combined with Windows shortcuts. Create a shortcut to HELM_RT.exe, and add the panel file name and any required parameters to it’s ‘target’.

Currently the Param_1..4 properties are not saved as part of the panel file. This can make debugging awkward, and will be changed  soon.

Tagged with: ,
Posted in HELM, Scripting