Using the Plug Spy 2 AppleScript Action

Some weeks ago we have added an AppleScript action to Plug Spy. With AppleScript it will be able to do anything you would like to do including automatically formatting your hard drive after unexpected activity is detected. Here I will explain how you can set up an AppleScript to work with Plug Spy.

Thee first thing you would do is to  open the “Action-Set” Preferences panel and select the desired preset. After you have setup the rules which will trigger the alert you can activate the AppleScript action by selecting it in the popup menu on the right. The AppleScript action will appear in the action pane and is ready to be customised. Click the action to open the settings popover and open the Script handler menu. If there is no script in the script folder of Plug Spy you have to open the “Plug Spy Apple Script” folder to add a script in Finder. You may now that since Mavericks Apps are only able to use an AppleScript if it is placed in a folder related to the application.

To create an Apple Script you will use the Script Editor which is by default available on your Mac. There are plenty of sources in the internet which explain and show you how to write an Apple Script. If you have an idea what the script should do the best way is a search a template script and modify it until if accomplish your needs. To get the script work with Plug Spy you will have to define a function named

plugSpy_action(message) to place your script inside. This function will be called whenever the action is triggered. The message parameter will contain a string with the current sensor activity. The return value should be “OK” but is currently not evaluated in Plug Spy.

Example script:

on plugSpy_action(message)

    display dialog message

    return “ok”

end plugSpy_action

 

When you are ready with the script, place it in the Plug Spy script folder and select it in the Apple Script action settings script handler menu. If you are done you can test the script with the test button. Please consider that under normal circumstances there is a maximum of 15 seconds to run the script after the lid get closed before your Mac Book will sleep. Of course you can install a kernel extension like NoSleep or InsomniaX for Mac to prevent your computer from sleep.

 

4 thoughts on Using the Plug Spy 2 AppleScript Action

  1. Hi,

    Somehow my app has lost the lic? I have had the app for years but somehow the lic is no longer? If you check my email, I should be on record.

    Thank you

  2. Hello,

    please can you send us an email that we can fix this issue.

    Thanks and best regards,

    Marc

Leave a Reply

Your email address will not be published.