Product
Support
Everything Else
Triggering a Plan via AppleScript
Introduction

Helix Maintenance Manager (aka HMM) is a powerful tool in its own, but sometimes it’s useful to integrate it with other tools. This is most easily done via AppleScript. Chapter 12 of the HMM manual talks about calling other applications with HMM, but what about calling HMM from other applications?

HMM's scripting support is a work in progress, and is confined to a limited set of commands. It is our intention to expand this in the future, but if you want to put this into use now, this article explains how.

Scriptable Commands

In HMM only the ...On Clipboard menu commands (found in the Plan menu) are accessible through AppleScript. These commands compare the text on the clipboard with the known plans and if a match is found, that plan is executed. There are commands for running, editing, and deleting plans specified by storing the plan name on the clipboard.

To access these commands, you must know their internal names:

CommandInternal Name
Run Plan on ClipboardrunScriptClip
Edit Plan on ClipboardeditScriptClip
Delete Plan on ClipboarddeleteScriptClip

Quit is directly supported.

Scripting HMM

The scriptable commands are found in a sub menu of a special menu named TheScriptMenu. This menu must be explicitly addressed, as this AppleScript example illustrates:

property planToRun: "testMyCollection.plist"
property HMMTimeout : 3600 -- 60 seconds * 60 minutes = 1 hour
on run
  tell me
    set the clipboard to planToRun
  end tell

  tell application "Helix Maintenance Manager"
    activate
    set scriptMenu to sub menu of menu item "TheScriptMenu" of main menu
    set myItem to menu item "runScriptClip" of scriptMenu
    with timeout of HMMTimeout seconds
      tell myItem to perform action
    end timeout
    quit
  end tell
end run

Concluding Remarks

As mentioned above, scripting in HMM is a work in progress, and while we will try our best to maintain compatibility with these commands in future releases of HMM, they may change in future releases.

You can also trigger HMM menu items via Apple’s GUI Scripting, which simply finds the menu items and selects them as if you had chosen them with the mouse. The GUI Scripting interface is less likely to change, so if you do not mind the overhead of having GUI Scripting installed and activated, you may prefer to use that instead.

We are interested in understanding how HMM scripting is being used and how it should be expanded in the future, so if you find this useful or limiting, let us know.