Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

fred6633

macrumors newbie
Original poster
Sep 19, 2010
10
0
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
 
Code:
[b]set[/b] [color=#408000]appName[/color] [b]to[/b] [i][color=#0000ff]missing value[/color][/i]
[b]tell[/b] [i][color=#0000ff]application[/color][/i] "System Events"
    [b]set[/b] [color=#408000]appName[/color] [b]to[/b] [color=#6c05d3]name[/color] [b]of[/b] [b]the[/b] [b]first[/b] [i][color=#0000ff]process[/color][/i] [b]whose[/b] [color=#6c05d3]frontmost[/color] [b]is[/b] [color=#4a1e7f]true[/color]
[b]end[/b] [b]tell[/b]
[b]tell[/b] [i][color=#0000ff]application[/color][/i] [color=#408000]appName[/color]
    [b][color=#0000ff]print[/color][/b] [b]the[/b] [b]front[/b] [i][color=#0000ff]document[/color][/i] [color=#0000ff]with properties[/color] {[color=#6c05d3]copies[/color]:1, [color=#6c05d3]error handling[/color]:[color=#4a1e7f]standard[/color]} [b]without[/b] [color=#0000ff]print dialog[/color]
[b]end[/b] [b]tell[/b]
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.