on run (argv) set argn to count of argv set appName to "Vitamin-R 2" tell application appName activate end tell tell application "System Events" tell process appName set frontmost to true set mainWindow to window "Window" set currentStep to name of static text 1 of mainWindow if currentStep = "What's Next?" then tell mainWindow click radio button "Continue later" of radio group 1 click button "Continue" set currentStep to name of static text 1 end tell end if if currentStep = "Which Kind of Break?" then tell mainWindow click radio button "Open-ended break" of radio group 1 click button "Start" end tell set frontmost to true set currentStep to name of static text 1 of mainWindow end if tell mainWindow if currentStep = "Time Remaining:" then click button "Finish" set currentStep to name of static text 1 end if if currentStep = "On an Open-Ended Break…" then click radio button "Continue with a new time slice" of radio group 1 click button "Continue" set currentStep to name of static text 1 end if if currentStep = "Define the Objective for This Time Slice" then set objectiveArea to text area 1 of scroll area 1 set tagsField to text field 1 if argn > 0 then set value of objectiveArea to "" get the value of objectiveArea set value of objectiveArea to item 1 of argv get the value of objectiveArea end if if argn > 1 then set value of tagsField to "" get the value of tagsField set value of tagsField to item 2 of argv get the value of tagsField set focused of tagsField to true keystroke return end if click button "Start" return "OK" else display dialog "Cannot start new time slice:" & currentStep return end if end tell end tell end tell end run