Re: UI Printing
Re: UI Printing
- Subject: Re: UI Printing
- From: Bill Cheeseman <email@hidden>
- Date: Fri, 5 Mar 2010 08:47:51 -0500
On Mar 5, 2010, at 8:34 AM, Thomas Fischer wrote: I realised two things about the command keystroke "p" using {command down}
– the command is case sensitive, keystroke "P" doesn't work, although the shortcut is called ⌘P. – the curly braces are not mentioned in System Event's library, is this something oovious?
And I somehow lost the context: Is there a particular reason not to use Mail's print command like
tell application "Mail" to print Window 1
or something similar before
click button 1 of sheet 1 of window 1
In GUI Scripting's 'keystroke' command, if you capitalize the letter, the Mac thinks you're holding down the Shift key. So 'keystroke "P" using {command down}' is equivalent to 'keystroke "p" using {command down, shift down}'. That actually works in some applications that have an alternate Shift-Command-P print command that does something different than the regular print command.
Curly braces are standard AppleScript. They signify an AppleScript list, in this case a list of terms identifying which modifier keys are down.
In GUI Scripting, the only reason to prefer the 'keystroke' technique over the 'click menu x' approach is that you don't have to watch the menu open and close when the script executes. The only, only, only reason to prefer GUI Scripting over regular AppleScript is if regular AppleScript doesn't work. If an application supports regular AppleScript to do the task, you should always use regular AppleScript because it is likely to be faster due to the application's internal implementation of the command.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden