Yesterday, we looked at how Power Manager can be used to automatically open and start a Keynote presentation. Today, we will create an event to stop the presentation at a specific time each day. Paired together these two events can be used to start and stop Keynote presentations without needing to touch the Mac.
There is more than one way to automate the stopping of a Keynote presentation. If you use Power Manager to shut down your Mac, you can leave Keynote running and let the shut down process tidy up for you.
For our event, we will not quit Keynote, but instead ask Keynote to stop the slideshow. We will do this using a small AppleScript snippet embedded in the event.
Creating an Event to Automatically Stop Keynote
- Launch System Preferences and select Power Manager.
- Click Add… to create a new event.
- Choose the template Run a script daily.
- Where Power Manager asks for the Script to run, copy and paste in the following AppleScript:
#!/usr/bin/osascript tell application "Keynote" stop slideshow end tell
- Continue to the next step.
- Select the time and days to stop your presentation.
- Continue through the remaining steps until your event is created.
The event is now ready and scheduled. The event works by running the AppleScript snippet when triggered each day. The AppleScript embedded within the event asks Keynote to stop the current slideshow.
Power Manager performs a little magic and performs the AppleScript as the active, frontmost, user. This allows Power Manager to perform AppleScripts that include interaction with other applications and with the graphical interface.
This event is self-contained. The AppleScript is included in the event. You can freely share your Keynote controlling events with others via e-mail, without needing to rely on other files.