Re: Applescript to print Odd Pages only
Re: Applescript to print Odd Pages only
- Subject: Re: Applescript to print Odd Pages only
- From: Bill Guion <email@hidden>
- Date: Sat, 29 Jun 2013 23:04:59 -0400
On Jun 29, 2013, at 10:03 PM, Kaydell Leavitt wrote:
> Hi Bill,
>
> I believe that a better way to get an application to print from an AppleScript is to use AppleEvents.
>
> I just looked at the AppleEvent dictionary for Microsoft Excel and it has many different kinds of print command available from AppleEvents which make them available from AppleScript as well.
Kaydell,
Yes, I looked at those, but could not find any that get to the odd/even page option. That's why I decided to try the GUI.
> The advantage of using AppleEvents over using the GUI, is that you're talking more directly to the application, by-passing the application's GUI interface which is intended for human use, clicks and typing, and you would be using the interface to the application that is designed to be best for a script to talk to.
>
> Going through the GUI using AppleScripts should be a last resort for Mac apps that don't support AppleEvents.
>
> You can view an AppleEvent dictionary for Microsoft Excel by doing the following:
>
> 1. Open Script Editor
> 2. From the "File" menu, choose "Open Dictionary..."
> 3. Find the application "Microsoft Excel"
> 4. Search for "print" in the search box.
> 5. You'll see some of the many different print commands that are available in Excel
Yup, looked at all those. None get me where I need to get.
-----===== Bill =====-----
>
> There's a learning-curve in using AppleScript to use AppleEvents to control applications, but this is actually what AppleScript was designed to do.
>
> -- Kaydell
> email@hidden
> http://learnbymac.com
>
> On Jun 29, 2013, at 7:42 PM, Bill Guion <email@hidden> wrote:
>
>> I'd like a hint (or some hints) for AppleScripting this work flow.
>>
>> Occasionally I print front and back of pages, but my printer only prints on one side. So, I print all the odd pages, take the output and turn the set over, and put in the manual paper feed. Then I print all the even pages.
>>
>> This works, but does involve a number of mouse clicks, so I thought I'd write an AppleScript to minimize the clicking. What I envision is running a script to print the odd pages, then manually putting the output in the manual feed tray, and finally running a script to print the even pages. Two clicks, if I've counted properly.
>>
>> Okay, so the process, for example with Excel, is:
>> File menu, Print
>> The next window has three popup menus: the first is Printer, the second is Presets, and the third is Copies & Pages. Click on Copies & Pages and a popup is revealed with seven options, one of which is Paper Handling. Click on Paper Handling and the window changes, with Pages to Print as one option. Click on Pages to Print, and you get three options: all pages, odd pages, and even pages. Here I select either odd or even, depending on where I am in the work flow.
>>
>> So far, I have
>>
>> tell application "System Events"
>> tell process "Excel"
>> click the menu item "Print..." of the menu "file" of menu bar 1
>> delay 1
>> end tell
>> click menu item "Paper Handling" of the menu "Copies & Pages" of menu bar 3
>> end tell
>>
>>
>> The script through line three brings up the print dialog window. But I have not been successful at selecting the Copies & Pages popup. I've tried a number of variations of line 6. The line 6 above generates this error: error "System Events got an error: Can’t get menu bar 3." number -1728 from menu bar 3
>>
>> If I leave off the of menu bar 3, the error becomes: error "System Events got an error: Can’t get menu \"Copies & Pages\"." number -1728 from menu "Copies & Pages".
>>
>> I'm reasonably sure (assuming that it can be done) that my problem is with terminology, but If anyone could give me some hints about how to proceed, I would appreciate it.
>>
>> Aside - I have created preset settings for odd and even, but with AppleScript I'm still faced with selecting from the preset popup menu from the print dialog window.
>>
>> -----===== Bill =====-----
>> _______________________________________________
>> 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
>
-----===== Bill =====-----
--
Murphy's Law Cardinal Conundrum -
The optimist believes we live in the best of all possible worlds.
The pessimist fears this is true.
_______________________________________________
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