Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

AppleScript to press Escape key (3x) for Excel

Hi all,


I'm trying to automatically convert Excel files to PDFs using Automator. Although, every time the Excel file is opened, I get a message about links to other workbooks. I really don't care about these links and just want to convert the file to a PDF. I just can't get Automator to press the "Ignore links" button on the Excel message.


Now I've found out that pressing the escape key on my keyboard activates the following buttons on the Excel message about the links:

- "Update links" (then there's a Finder window popping up)

- "Cancel" (the search for other workbooks) (another Finder window pops up)

- "Cancel" again


Then Excel opens up the file I need to convert, so I can actually convert it using Automator and do whatever I want with it.


I have absolutely no experience using AppleScript.Is there a way to make a AppleScript that presses the escape key three times, so that Excel just opens my file?


Thanks in advance

Mac OSX Lion Server-OTHER, Mac OS X (10.7.3)

Posted on Mar 20, 2012 2:11 PM

Reply
Question marked as Best reply

Posted on Mar 20, 2012 2:36 PM

Pressing the Escape key is trivial:


tell application "System Events"

repeat three times


key code 53

end repeat

end tell


Invoking this script at the right time is what's harder (plus, you might need a small delay between each keystroke to allow for the OS to handle the keystroke and display the next dialog, otherwise the second and third keystrokes might get lost.

4 replies
Question marked as Best reply

Mar 20, 2012 2:36 PM in response to LVfLd

Pressing the Escape key is trivial:


tell application "System Events"

repeat three times


key code 53

end repeat

end tell


Invoking this script at the right time is what's harder (plus, you might need a small delay between each keystroke to allow for the OS to handle the keystroke and display the next dialog, otherwise the second and third keystrokes might get lost.

AppleScript to press Escape key (3x) for Excel

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.