How to Run a Script from a Menu Item
Running a script from a menu bar item in Mac OS X is a great time saver. The menu bar is always available and easy to access. In this recipe we will create a menu item that triggers a shell script, all using Power Manager.
Running a script from a menu bar item in Mac OS X is a great time saver. The menu bar is always available and easy to access. In this recipe we will create a menu item that triggers a shell script, all using Power Manager.

Use Power Manager to run a script from the menu bar
In this recipe, the script will speak the words “hello world” using the command line tool say. You can embed any script you need performing. Power Manager supports any scripting language that can be called through the command line; these include bash, perl, php, python, ruby, and sh.
Create a Script On-Demand Event
Launch Power Manager.app
Click Add… to create a new event

Click Add… to create a new Power Manager event
- Select the Run a script on-demand task

Select the "Run script on-demand" task
Continue to the Script step
Copy and paste in the script in the Script to run field:
#!/bin/sh say "hello world" exit 0

Paste in or type the script to run
- Continue passed the Constraints step onto the Why step.

Continue passed the Constraints step
- In the Why step name and add any optional notes about your new event.

Name the new event and add optional notes
- Continue to the final Confirm step.

Confirm the event can be created
- Add your new on-demand event.

The event is created and ready for use
Your new event is ready to use immediately. The event has no associated schedule, so will only be triggered on-demand. You can trigger this event and its script through the Power Manager menu bar item, with the command line tool
pmctl, or using your iOS device using
Power Manager Remote.