Auto run a UI app and click a button on startup
Save a script like this as ~/Library/Scripts/test.scpt in AppleScript Editor:

tell application "Grapher"
    activate
    reopen
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:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
http://www.apple.com/DTDs/PropertyList-1.0.dtd&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;test&lt;/string&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;osascript&lt;/string&gt;
        &lt;string&gt;/Users/username/Library/Scripts/test.scpt&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;RunAtLoad&lt;/key&gt;
    &lt;true/&gt;
&lt;/dict&gt;
&lt;/plist&gt;


More information about UI scripting and launchd:


http://www.macosxautomation.com/applescript/uiscripting/index.html
man launchd.plist
http://nb.nathanamy.org/2012/07/schedule-jobs-using-launchd/