New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Applescript - Duplex printing from Pages


Post Reply New Thread Subscribe

 
Thread Tools
phil.black

 
Member Since: Feb 11, 2012
Posts: 1
phil.black is on a distinguished road

phil.black is offline
I need help!

Does anyone know why the Applescript Print command (initiated to Pages in my case) uses different settings when not displaying the Print dialog box, than those that are selected within the Print dialog box if it is displayed via (Print with print dialog)?

e.g. with all other things equal,
'Print myDoc without print dialog' has a different outcome to...
'Print myDoc with print dialog' and the Print button clicked.

Background

I'm writing a script to automate the printing of a site notes. It's fairly simple: display a dialog to the user, the user enters a few details (such as a property address, contact name etc.), and the script opens a Pages document (named myEPC), adds the user entered data, and prints it out to my printer 'Daisy'.

This all works ok, except I can not get it to print double sided!

Applescript allows a number of properties to be specified along with the Print command - but not the 'Double Sided' setting.

Firstly, after searching the forums I followed advice to create a printing Preset (which I called Duplex) that specifies double sided printing. This works fine when printing manually BUT NOT when invoked via Applescript, using:

print myEPC with properties {target printer:"Daisy"}

Next, in an effort to force the Duplex Preset, I tried the following shell script commands before the Applescript print command:

do shell script "defaults write com.apple.print.custompresets.forprinter.Daisy com.apple.print.lastPresetPref 'Duplex'"
do shell script "defaults write com.apple.print.custompresets.forprinter.Daisy com.apple.print.lastPresetPrefType 3"
print myEPC with properties {target printer:"Daisy"}

Still no joy.

Finally, in an effort to see what's going on, I tried printing with & without displaying the Print Dialog, thus:

print myEPC with properties {target printer:"Daisy"} without print dialog

which, frustratingly, prints the document single sided....

print myEPC with properties {target printer:"Daisy"} with print dialog

which displays the Print dialog - with EXACTLY the settings I'd like the document to print with - but necessitates me hitting the Print button, thereby undermining my efforts to automate the whole process.

Can anyone explain what's going on?

Thanks in advance,
PB
QUOTE Thanks

Post Reply New Thread Subscribe


« Applescript Snow Leopard to Lion | Just a question »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
MacBook Pro all of a sudden printing blank pages Sabinem Apple Notebooks 3 04-03-2011 03:40 PM
Can't Return to Single Duplex Printing ClintonMagus OS X - Apps and Games 3 07-13-2010 12:30 AM
Brother DCP-115C printing slow and really tiny fonts and pages.. catcufflings Other Hardware and Peripherals 3 03-02-2010 03:50 AM
Using Applescript in Word and Pages mwebster51 OS X - Operating System 0 08-21-2008 02:28 AM
Error Printing multiple pages (Hp 2600 via Airport) moutinhoabreu@g Other Hardware and Peripherals 0 01-09-2006 10:56 AM

All times are GMT -4. The time now is 12:02 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?