On Nov 1, 2011, at 4:43 AM, Axel Luttgens wrote:
Are you really sure to be able to *change* the value of "UI elements enabled" from AppleScript in Leopard and Snow Leopard, without having to provide any credentials?
Yes. I only discovered the problem when I tested the script in Lion. Prior to that, in previous systems, I had been able to simply ...
tell application "System Events" to set UI elements enabled to ...
with no problem and no password.
I have looked at the dictionary for Printer Setup Utility and found ...
print v : Print a document.
print list of file or specifier : The file(s), document(s), or window(s) to be printed.
[print dialog boolean] : Should the application show the print dialog?
which suggests that I can print a document without a print dialog which avoids having to use UI scripting to click buttons. So, I tried this ...
tell application "Printer Setup Utility"
print (window 1 of application "Mail") with properties {target printer:"CUPS-PDF"} without print dialog
end tell
and except for one little thing ... it works! And that one little thing happens to be the print dialog.
IT APPEARS! #$&! and therefore requires UI code to click the button.
Does anyone know any variations on a theme that might get Printer Setup Utility to work correctly?