Running Custom Scripts¶
Overview¶
QML Scripts can be run
By selecting a file from disk, or
By installing the script in a specific folder structure and selecting its corresponding menu item from the Scripts menu.
Running Script From Disk¶
In version 1.0, custom scripts could be run via the LAUNCH SCRIPT From File… menu item in the Batch menu.
In version 1.1, the new Scripts menu contains the LAUNCH SCRIPT From File… menu item.
In either case, the menu item will open an open file dialog and let you select a .QML file to execute.
Any valid QML file can be picked from any folder in any disk or network location.
Naming Rules And Conventions¶
The sub-folder name found in either of the two possible locations will be used as the name of the menu item.
For example, if the folder is called “My New Tool”, this is the name that will appear under the Scripts menu.
The folder must contain at least one .QML file which has exactly the same name as its parent folder.
This script will be the one to be executed when the menu item is activated.
In the above example, a file called “My New Tool.qml” must exist in the folder “My New Tool” and will be run when the “My New Tool” menu item is activated.
If such a file does not exist, the folder will be skipped and no menu item will be added for it in the Scripts menu!
The folder may contain further scripts that are loaded by the main script - they will not be run automatically.
The folder can contain an optional icon file, typically in .PNG format containing RGB and Alpha, named exactly the same as the parent folder and the main QML file.
In the above example, the icon file would be called “My New Tool.png”.
If no icon file is found, no icon will appear next to the menu item under the Scripts menu.
The icon will be resized to match the current menu icons resolution.
The default size is 16x16 pixels.
On macOS, menu icons are currently not supported.
The folder may contain other files and sub-folders, for example for image storage etc.
These can be referenced by the main script, but will be otherwise ignored by the Menu installation system.
Test-Running Scripts During Development¶
Each time a custom script menu item is activated, the source code of the script will be reevaluated.
This allows you to edit a script’s source code in any external editor, save the changes, and re-run the script by simply selecting its menu item again.
Note that it is NOT necessary to execute the REFRESH User Scripts menu item to update the script once it has been added to the Scripts menu!