How do I
The first step is to move all of the code so that it is contained within a function. For example, the following will set a specific zoom level:
Then you will need to use the app.addToolButton method to create the button. To continue with the above example, this would be as follows:
cName: "Zoom 175%",
cTooltext: "Zoom to 175%",
Parameters of addToolButton:
cName: Required – This is the identifier for the button and must be unique.
cLabel: Optional – Specifies text label to be displayed on the toolbar, next to the icon. If left blank, only the icon is used. If left blank and no icon is supplied, a stock icon is used and no label provided.
cExec: Required - This is where the function to be executed is entered.
cTooltext: Optional - The text entered here is used as the tool’s tooltip.
cEnable: Optional - Determines whether or not to enable button on the toolbar. Use true (default parameter) to enable or false to disable.
nPos: Determines the tool’s position on the toolbar. If -1 (default value) is entered, the tool is appended (added to the end of) the toolbar.
oIcon: Optional - Provides an icon for the toolbar button. An Icon Stream must be provided for this to work.