Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Applescript - Duplex printing from Pages
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="phil.black" data-source="post: 1368360" data-attributes="member: 237548"><p>I need help!</p><p> </p><p>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)?</p><p> </p><p>e.g. with all other things equal,</p><p>'Print myDoc without print dialog' has a different outcome to...</p><p>'Print myDoc with print dialog' and the Print button clicked.</p><p> </p><p>Background</p><p> </p><p>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'.</p><p> </p><p>This all works ok, except I can not get it to print double sided!</p><p> </p><p>Applescript allows a number of properties to be specified along with the Print command - but not the 'Double Sided' setting.</p><p> </p><p>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:</p><p> </p><p>print myEPC with properties {target printer:"Daisy"}</p><p> </p><p>Next, in an effort to force the Duplex Preset, I tried the following shell script commands before the Applescript print command:</p><p> </p><p>do shell script "defaults write com.apple.print.custompresets.forprinter.Daisy com.apple.print.lastPresetPref 'Duplex'"</p><p>do shell script "defaults write com.apple.print.custompresets.forprinter.Daisy com.apple.print.lastPresetPrefType 3"</p><p>print myEPC with properties {target printer:"Daisy"}</p><p> </p><p>Still no joy.</p><p> </p><p>Finally, in an effort to see what's going on, I tried printing with & without displaying the Print Dialog, thus:</p><p> </p><p>print myEPC with properties {target printer:"Daisy"} without print dialog</p><p> </p><p>which, frustratingly, prints the document single sided....</p><p> </p><p>print myEPC with properties {target printer:"Daisy"} with print dialog</p><p> </p><p>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.</p><p> </p><p>Can anyone explain what's going on?</p><p> </p><p>Thanks in advance,</p><p>PB</p></blockquote><p></p>
[QUOTE="phil.black, post: 1368360, member: 237548"] 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]
Verification
Name this item. 🍎
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Applescript - Duplex printing from Pages
Top