I am encountering the same problem trying to execute some simple cut and paste operations to a website that only accepts one item at a time. I did the "watch me" routine and the script looks reasonable, but yet it get the error message of:
"Application Excel is not running when it is expected to."
The script is pasted below but is a lot more simple looking in Automator than down below.
I am using the current version of Mac O/S 10.9.4 on a Macbook Pro with Microsoft Excel 14.4.4 (Office 2011 for Mac).
Script pasted from automator:
******************************************************************************** *************************************
-- Bring the window “Skywardexport.xlsx” to the front.
delay 2.387595
set timeoutSeconds to 2.000000
set uiScript to "click window \"Skywardexport.xlsx\" of application process \"Excel\""
my doWithTimeout( uiScript, timeoutSeconds )
-- Click the “Edit” menu.
delay 1.769971
set timeoutSeconds to 2.000000
set uiScript to "click menu bar item \"Edit\" of menu bar 1 of application process \"Excel\""
my doWithTimeout( uiScript, timeoutSeconds )
-- Go To...
delay 2.392007
set timeoutSeconds to 2.000000
set uiScript to "click menu item \"Go To...\" of menu 1 of menu bar item \"Edit\" of menu bar 1 of application process \"Excel\""
my doWithTimeout( uiScript, timeoutSeconds )
-- Type 'b3'
delay 3.053997
set timeoutSeconds to 2.000000
set uiScript to "keystroke \"b3\""
my doWithTimeout( uiScript, timeoutSeconds )
-- Press Return
delay 1.023963
set timeoutSeconds to 2.000000
set uiScript to "keystroke \"
\" "
my doWithTimeout( uiScript, timeoutSeconds )
on doWithTimeout(uiScript, timeoutSeconds)
set endDate to (current date) + timeoutSeconds
repeat
try
run script "tell application \"System Events\"
" & uiScript & "
end tell"
exit repeat
on error errorMessage
if ((current date) > endDate) then
error "Can not " & uiScript
end if
end try
end repeat
end doWithTimeout