PDA

View Full Version : Generic Applescript for printing




fred6633
Jul 1, 2011, 02:19 AM
Hello,

This script works:

tell application "Pages"
print the front document with properties {copies:1, error handling:standard} without print dialog
end tell

However, I would like a generic script that prints the front document in the active application, so I don't have to create one script for Pages, one for TextEdit, one for Preview and so on.

Fred



kainjow
Jul 2, 2011, 03:11 PM
set appName to missing value
tell application "System Events"
set appName to name of the first process whose frontmost is true
end tell
tell application appName
print the front document with properties {copies:1, error handling:standard} without print dialog
end tell