I needed to change my printer's advanced print setup automatically with AppleScript. AppleScript doesn't support this feature, so I found a way to do it with a shell script. First, create and save a custom settings preset in the printing dialog. For this example, assume those settings are named Preset1. Then, in the AppleScript Script Editor, enter the following code:
[robg adds: I broke the AppleScript onto three lines for better display here. I didn't want to use the AppleScript line break character, though, because the text inside the quotes cannot be broken in that manner. If you're going to use this code snippet, enter it as one long line with a space replacing each line break.]
do shell script
"defaults write com.apple.print.custompresets
com.apple.print.lastPresetPref Preset1"
This way, the Preset1 settings will be used next time you print.
[robg adds: I broke the AppleScript onto three lines for better display here. I didn't want to use the AppleScript line break character, though, because the text inside the quotes cannot be broken in that manner. If you're going to use this code snippet, enter it as one long line with a space replacing each line break.]
•
[11,255 views]

