This tool brings the power of custom scripting to the batch tools. If the available tools don't provide the exact functionality we need, we can code a custom tool.
The functionality is generic enough that the scripts don't need to be specific to the processment/management of PDFs, so it's also a easy way to run custom scripts, for any other file type or any type of task.
Because it uses the Active Scripting technology, the scripting language can be any, or a mix, of the active language interpreters, called engines, installed in the system, with JScript and VBScript ready available in any Windows default setup.
It also provides compatibility with the Windows Script Host object model with a root WScript named object, so it's ready to run many of already available WSH compatible scripts.
The tool dialog shows the list of available scripts, and provides the means to create a new script and edit or run the ones already available.
Some sample scripts are available, as shown in the above screenshot, and are the right place to start learning how all this work.
In the script options panel, related to the selected script, the option "show in the toolbar ", when checked, places a button with a default icon, or the icon defined using the button "Icon", in the PDF Info view toolbar, and the "show in the tools menu" options places a related menu item in the tools main menu, so the script can be started directly from the toolbar or tools menu, without the need to open this tool dialog. When the script is invoked this way, will have in the list of passed files the active one, if none selected, or all the selected.
The shortcut option provides the possibility to assign a keyboard shortcut to invoke the script, but will be active only if the script is set to show in the toolbar or tools menu.
The icon button opens an image selection dialog from where we can chose an image to use as icon of the item. Items without icon will show a default icon when placed in the toolbar, and the script name text as hint message or name of the item when shown in the tools menu.
When a script is executing it has available the batch tool output window to where text, and other script activity, can be outputted.
This output window is also useful to stop the running script, if by any reason we need to stop it. But some scripts may not need this interactivity, so this window will activate only if output activity required.
The "new" and "edit" buttons start the scripts editor, from where we can create, edit, run and debug our scripts.
This is a full featured editor and debugger, with syntax highlight, code format, search, replace and undo/redo functionalities.The debugger has console interactivity, variables and locals watch, call stack list, breakpoints, and stepped execution. The debugger depends on some DLLs that may not be installed in our systems. A easy way to get these is by installing the ancient, and free, Microsoft Script Debugger.
Creating a new script starts by giving it a meaningful name, that can be renamed at any time.
From the coding languages selector, that list the automation languages installed in the system, we choose the language of the script.
The script can also access code stored in the scripts library, and for that there is only the need to check the libraries we want to use from the includes <> button. This method can be used also to develop scripts in more than one language, as the included scripts can be coded in different languages.
The code syntax is specific to the chosen script language and this site is a good start for JScript and VBScript, and Active Scripting in general.
To access the internal functionality provided by the tools, mainly specific to the processment of PDFs, we have the pdfe named root object, that is always available, without the need to create it, from any scripting language. This object provides the equivalent functionality of the WScript root object of the Windows Script Host object model. Its functionality and usage is explained in detail in the My Scripts API topic.