- Joined
- Feb 11, 2012
- Messages
- 1
- Reaction score
- 0
- Points
- 1
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
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