Re: Excel2004, System Events & NSReceiverEvaluationScriptError
Re: Excel2004, System Events & NSReceiverEvaluationScriptError
- Subject: Re: Excel2004, System Events & NSReceiverEvaluationScriptError
- From: Bill Cheeseman <email@hidden>
- Date: Thu, 16 Dec 2004 16:30:11 -0500
on 2004-12-16 11:16 AM, Larry McMunn at email@hidden wrote:
> tell application "System Events"
> tell process "Excel_2004"
> keystroke "p" using command down
> -- problem occurs at the next line
> click button "Save As PDF" of UI element 4 of window "Print"
> keystroke "d" using command down
> keystroke "My Desired Worksheet"
> keystroke return
> end tell
> end tell
Larry,
Your script appears to be correct, but I can't make it work in Excel, either
-- even with lots of changes. I'm not sure what is going on.
When I use UI Browser to Perform the Press action on the PDF button, Excel
responds as expected. (To do this, you have to bring Excel to the front and
Command-click UI Browser's Perform button to keep UI Browser in the
background.)
Yet Excel does not respond to the GUI Scripting statement. This usually
means a bug in GUI Scripting, but I don't know why it would appear here and
not in the Print sheet of other applications.
In most applications, the Print window is a sheet. In TextEdit, for example,
this script works just fine:
activate application "TextEdit"
tell application "System Events"
tell process "TextEdit"
keystroke "p" using {command down}
click button 2 of UI element 3 of sheet 1 of window 1
keystroke "d" using command down
keystroke "My Desired Worksheet"
keystroke return
end tell
end tell
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
PreFab Software - http://www.prefab.com/scripting.html
The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden