Shell script - duplex printing query...

Hi There,

Using the follow shell command a script can change the default paper size selected:-

do shell script "defaults write DefaultPaperID iso-a4"

Please can someone tell me if it’s possible to turn on duplexing in a similar way.

If I use OmniOutliner to view the file ‘’ I can see ‘Expanded PDEs’,
can one of these be set to switch on duplexing or select a preset that does?



Model: G5
Browser: Safari 312.3
Operating System: Mac OS X (10.4)

Nick, I can get all that additional extras to my printers via presets duplexing being one of them. The only thing I needed to change to make things easier was replace spaces in preset names to underscores.

-- Set Selected printer in Print Dialog: {Specific Printer = 0, Last Used = 1}
do shell script "defaults write UseLastPrinterAsCurrentPrinter 1"

-- Record the default paper size
do shell script "defaults read DefaultPaperID"
set defaultPaper to the result as string

-- Set Default paper size in Page Setup: {na-letter, na-legal, iso-a4, iso-a5, roc16K, jis-b5, iso-b5, na-number-10-envelope, iso-designated-long-envelope, cho-3-envelope, tabloid, iso-a3, arch-b, arch-b-extra}
do shell script "defaults write DefaultPaperID iso-a4"

-- Set back the default paper size
set theShell to "defaults write DefaultPaperID" & space & defaultPaper
do shell script theShell

-- Last used preset name
do shell script "defaults read"
set lastPreset to the result as string

-- Set last used preset
do shell script "defaults write 3535_Duplex"

-- Set last used preset
set theShell to "defaults write" & space & lastPreset
do shell script theShell

-- Read a saved presets data
do shell script "defaults read HP5000_Max_Quality"

Hi Mark,

Thanks for your reply, that’s great, will give them a try.



Working forward from Mark’s earlier post I’ve been trying to extract the PresetNames that are available.
If I execute the script below:-

do shell script "defaults read"

I get two preset names listed under ""=(preset1, preset2);

I’ve been trying to extract these preset names from the rest of the information, that is returned, however as yet I’ve had no success. Please can someone point me in the right direction. I’d like to allow the user to choose the preset they require.

Thanks in advance,



I’m also looking to Duplex print but cannot make this work.

Does this also work for non-Applescript programs like Preview?

What am I doing wrong? I’m just trying to write a simple Folder Action that when a PDF gets added to a folder it is printed using Duplex (I defined a setting with Two-Sided Printing called “Duplex”)

on adding folder items to this_folder after receiving these_items
	do shell script "defaults write Duplex"
	tell application "Finder" to print these_items
end adding folder items to

This works for me now, at least with Adobe Reader :smiley:

on adding folder items to this_folder after receiving these_items 
tell application "Finder" 
repeat with aFile in these_items 
tell application "Finder" to print aFile 
delay 1 
tell application "System Events" to keystroke (ASCII 
character 3)
end repeat 
end tell 
end adding folder items to