I'd like to fill in the Keychain Dialog box with the Name: and Password fields (printer is windows print queue), but after the Print command, the Keychain dialog box opens up, but never responds to anything till I click OK or cancel.

  tell application "TextEdit"
  make new document

  print document 1 with properties {target printer:"2nd-floor"}

  tell application "System Events"

         set value of text field 1 of group 1 of window 1 to "CUA\name"

         click button 2 of window 1 of application process "SecurityAgent"

  end tell
  end tell

Hope I missing something silly, thanks.


Consider altering the requirement for a password. Printers on Mac OS X are managed by the Common UNIX Printing System (CUPS) and it is highly configurable.

Mac OS X Hints published this, Disable printer queue password requirements, for disabling printer queue passwords. It should work for modern versions of OS X:

  1. As root, or in a Terminal session with su privileges, edit /etc/cups/cupsd.conf.
  2. Find the section below.
  3. Remove the items you don't want limited: Pause-Printer, Resume-Printer, Pause-Printer-After-Current-Job, etc.
  4. Save the file, quit the editor, and restart your computer

Section to find and edit:

  <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Res
tart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Accept-Jobs CUPS-Reject-Jobs>
      AuthType Default
      Require user @AUTHKEY(system.print.admin) @admin @lpadmin
      Order deny,allow
  • I think this all refers to the Administrative password for the Mac you are trying to print from. I am looking to enter the domain\username and password for the windows print queue (smb:\\server.com\printqueue) that our students are trying to print to. – Len Jun 10 '14 at 15:00
  • Have you considered embedding your credentials in the smb:// URL or used smbpasswd to store the password securely? willem.engen.nl/projects/cupssmb and samba.org/samba/docs/man/Samba-HOWTO-Collection/… might be useful for this approach. – Graham Miln Jun 10 '14 at 15:33
  • Since my university forces students to change passwords every 6 months, I originally thought that would not work. But the installing printers part of my applescript works well, so that I am going to look at that method. It would mean they would have to run the script again in 6 months when their password expires, but they were going to have to update their keychain anyway, thanks for the suggestion -Len – Len Jun 10 '14 at 15:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .