Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to do two things when my Mac boots up:

1) Run an app
2) Click a button on that app

Any suggestions for how I can accomplish this? FWIW, this is app I haven't written so I can't change source or pass in command line params.

share|improve this question
The run part is reasonably simple. Right (alt) click the app in the dock, mouseover "Options", select "Open at Login". – bassplayer7 Dec 7 '12 at 20:10

Save a script like this as ~/Library/Scripts/test.scpt in AppleScript Editor:

tell application "Grapher"
end tell
tell application "System Events" to tell process "Grapher"
    click radio button 2 of tab group 1 of window 1
    -- UI elements of window 1
end tell

Save this as ~/Library/LaunchAgents/test.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN>
<plist version="1.0">

More information about UI scripting and launchd:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.