Registering Custom Tools

Stylus Studio allows you to register custom tools to run alternative editors, processors, preprocessors, or postprocessors. For example, you can register a custom tool that configures Internet Explorer to display the document you are working on.

After you register a custom tool, Stylus Studio adds an entry to its Tools menu - select Tools and then your tool. The order in which the tool names appear in the Custom Tools options page is the order in which the tool names appear in the Stylus Studio Tools menu.

You can register custom tools from within Stylus Studio or from the command line.

Using Stylus Studio

To register a custom tool in Stylus Studio:
1. From the Stylus Studio menu bar, select Tools > Options.
Stylus Studio displays the Options dialog box.
2. Click Custom Tools to display the Custom Tools page.
3. In the Custom Tools page, click Define New Tool .
Stylus Studio displays an entry field for the tool name.
4. Enter the name as you want it to appear in the Stylus Studio Tools menu.
5. In the Command field, specify or select the absolute path for the command that runs your tool. This must be a .exe, .bat, or .cmd file.
6. In the Arguments field, specify any arguments your tool requires. You can click to display a drop-down list that includes File Path, File Dir, File Name, File Extension, and Classpath.
7. In the Initial Directory field, type the absolute path for the directory that contains any files or directories needed by your custom tool.
8. In the Path field, type any paths that need to be defined and that are not already defined in your PATH environment variable.
9. If you want Stylus Studio to prompt for arguments before it runs your tool, click Prompt for Arguments.
10. If you want Stylus Studio to display output from your custom tool in its Output Window, select Use Output Window.
11. If you want Stylus Studio to save all open documents before running this tool, select Save All documents before execution.
12. Click the OK button.

Using the Command Line

To register a custom tool using the command line:

The format for the command line is:

struzzo /newCustomTool "Tool n:=Tooln; Args= value; Command=value; Description=value; Initial Directory=value; Path=value; PromptArgs=value; RedirectOutput=value; DoSaveAll=value"

Example:

struzzo /newCustomTool "Tool 0:=Tool 0;Description=Avalon Uploader; Command=AVRPTLDR.exe;Args= ${FilePath}"

Arguments for the newCustomTool function are described in the following table:

Table 7. Properties for Registering Custom Tools
Name
Description
Tool n:
The full syntax for this property is Tool n:=Tool n, where n is some number. The number, n, specifies the order in the Tools menu in which the custom tool you are registering appears. You might use 0 for the first tool you register, 1 for the second, and so on. Valid values are numbers starting with 0.
The first part (Tools n:=) is used to create a key in the Windows registry. The second part (Tools n) is used as a prefix for other entries in the registry key that correspond to this tool. The two values should always be the same (Tools 1:=Tools 1, for example).
Args
Command line arguments for the tool you are registering.
Command
The absolute path for the command that runs your tool. This must be a .exe, .bat, or .cmd file.
Description
The tool name as you want it to appear on the Stylus Studio Tools menu.
Initial Directory
The working directory for the tool. This is the absolute path for the directory that contains any files or directories needed by your custom tool.
Path
Any paths that need to be defined and that are not already defined in your PATH environment variable.
PromptArgs
Whether you want Stylus Studio to display the Parameters dialog box each time this tool is run. Valid values are 0 (do not display the Parameters dialog box) and 1 (display the Parameters dialog box).
RedirectOutput
Whether you want the output directed to the Stylus Studio Output window. Valid values are 0 (do not redirect) and 1 (redirect).
DoSaveAll
Whether you want Stylus Studio to save all open documents before running this tool. Valid values are 0 (do not save) and 1 (save all).
 
Free Stylus Studio XML Training: