Create a least one subfolder under the macros folder to
contain your JavaScript files. If you save JavaScript files directly
in the macros folder, they do not appear on the Macros menu in Designer.
You can organize macros subfolders different ways. The method
you choose, depends on your needs. Consider the number of JavaScript
files you have, the number of macro.xml files to create, and the
order of commands on the Macros menu.
One way to organize the macros subfolders is to save all JavaScript
files in one subfolder. This way, you use one macro.xml file to
specify the names of all JavaScript files in the folder, and names
of the associated Macros menu commands. The order of the commands
on the Macros menu, is the same as the order of macros listed in
the macro.xml file.
Example macro.xml file containing multiple macros:
<?xml version="1.0" encoding="UTF-8"?>
<designerMacros>
<macro>
<label>Get Designer Locale</label>
<!-- Description - Get Designer locale -->
<script>getLocale.js</script>
</macro>
<macro>
<label>Hello World</label>
<!-- Description - Display Hello World -->
<script>helloWorld.js</script>
</macro>
<macro>
<label>Highlight Text</label>
<!-- Description - Highlight text areas -->
<script>HighlightFields.js</script>
</macro>
<macro>
<label>Refactor</label>
<!-- Description - Refactor -->
<script>refactor.js</script>
</macro>
<macro>
<label>Show Flex Sample</label>
<!-- Description - Show Flex Sample -->
<script>showFlexSample.js</script>
</macro>
</designerMacros>
Another way to organize the macros subfolders is to save JavaScript
files in separate subfolders. You use a macro.xml file in each subfolder
to specify the name of the JavaScript files, and name the related
Macros menu commands. The order of the commands on the Macros menu,
is the same as the order of subfolders and the macros listed in
each macro.xml file.
Keep in mind that all the subfolders you create for JavaScript
files must be a child of the macros parent folder (macros\MyMacros).
Designer does not scan subfolders below the level of the first subfolder.After
you add a JavaScript file to a macros subfolder, the name of the
file appears under the Macros command on the Tools menu. If you
want to display a name other than the JavaScript filename, you can
create an XML configuration file named macro.xml to change the name.