Hi jaol,
Right now, I have pdf workflow running:
http://www.apple.com/applescript/print/
so, I can’t go throught the whole process of making your thing work. I don’t like crunching things. When you crunch your script, it’s harder to tell where things aren’t working. If you want a sure thing, then go step by step. What I do is start with the first step and ‘get ui elements’. You might want to jump to your other targets, but step by step is like this. First:
tell application “Safari” to activate
tell application “System Events”
tell process “Safari”
keystroke “p” with command down
end tell
end tell
Next, instead of using the name of the front window use front window and get ui elements:
tell application “Safari” to activate
tell application “System Events”
tell process “Safari”
keystroke “p” with command down
tell front window
UI elements
end tell
end tell
end tell
In the list for the result there is window “Print” and get ui elements of that:
EDITTED: oops, forgot to post this:
tell application “Safari” to activate
tell application “System Events”
tell process “Safari”
keystroke “p” with command down
tell front window
tell window “Print”
UI elements
end tell
end tell
end tell
end tell
Now there is ui element 1 in the result so:
tell application “Safari” to activate
tell application “System Events”
tell process “Safari”
keystroke “p” with command down
tell front window
tell window “Print”
tell UI element 1
UI elements
end tell
end tell
end tell
end tell
end tell
The result now has a bunch of stuff. By trial and error getting ui elements you’ll find your way to where you should click. After a few times, you’ll know your machine and will have few problems with the targets.
Maybe it was that ‘sheet’ part that caused the error.
gl,