Skip to main content
Solved

Applescript - LPD Printer - editing DeviceURI in printers.conf

  • April 1, 2014
  • 12 replies
  • 34 views

Forum|alt.badge.img+5

Ok, I've hacked away for hours, but I just can't seem to finish an Applescript that I'm working on for our image.

I've managed to create the following:
- an Applescript that prompts for UserID, Password, Email and sets up an Outlook account

I'd like to do the following within the same script:
- take the UserID variable that was created above and edit the printers.conf file by changing the DeviceURI...

from (current file text in printers.conf in cups.DMG that is deployed):
lpd://EMPLOYEE@10.100.153.197

to:
lpd://{UserID}@10.100.153.197

Sorry if that's complicated. Hard to be concise. I've search the posts on JAMF, but not breaking through.

Best answer by joshmac777

Here's the example script, for reference
https://www.dropbox.com/s/qeq1s5xw593t5tw/Outlook%26Printer-Example.scpt

12 replies

Forum|alt.badge.img+5
  • Author
  • New Contributor
  • April 1, 2014

Here's the example script, for reference
https://www.dropbox.com/s/qeq1s5xw593t5tw/Outlook%26Printer-Example.scpt


Forum|alt.badge.img+5
  • Author
  • New Contributor
  • Answer
  • April 1, 2014

Here's the example script, for reference
https://www.dropbox.com/s/qeq1s5xw593t5tw/Outlook%26Printer-Example.scpt


Forum|alt.badge.img+5
  • Author
  • New Contributor
  • April 1, 2014

Sorry, double post for some reason


bentoms
Forum|alt.badge.img+35
  • Hall of Fame
  • April 1, 2014

We use an AppleScript app @ login to mount drives & printers.

Not sure if it'll help, but linking just incase it does:

http://macmule.com/2011/09/08/how-to-map-drives-printers-based-on-ad-group-membership-on-osx/


Forum|alt.badge.img+5
  • Author
  • New Contributor
  • April 1, 2014

Thanks bentoms.

I think just switching out the text should do the trick, but applescript text replacement is proving to be a pain as I hack away.


Forum|alt.badge.img+5
  • Author
  • New Contributor
  • April 1, 2014

I'm at a bit of a loss. The printer is set up in the advanced tab (being an LPD setup) of Sys Prefs.

So, scripting the manual setup via "AddPrinter" just wasn't working.

Then, I switched to the idea of dropping the printers.conf file in by DMG and editing that. But, it's proving to be a pain.


talkingmoose
Forum|alt.badge.img+36
  • Community Manager
  • April 3, 2014

I took a quick look at what you're wanting to do and see a stumbling block.

The script is going to run under the current user's credentials and his privileges but I'm finding the /private/etc/cups/printers.conf file isn't even readble by the Standard user.

Not sure what you're referring to by "cups.DMG". Where's that coming into play?


Forum|alt.badge.img+12
  • Contributor
  • April 4, 2014

You can use the following shell command:

lpadmin -v lpd://{UserID}@10.100.153.197 -d [Printer Queue Name]

Forum|alt.badge.img+5
  • Author
  • New Contributor
  • April 8, 2014

Thanks all. Yeah, passing the variable into lpadmin looks good.

Just gotta find the right Generic postscript driver now.

Seeing this one in the PPD... *PPD-Adobe: "4.0"

Default "drv:///sample.drv/Generic.ppd" doesn't work with our duplex system.


Forum|alt.badge.img+5
  • Author
  • New Contributor
  • April 8, 2014

Or, at least, for whatever reason, I can't seem to get the option triggered to select "Duplexer" in the options, using the default generic driver.


Forum|alt.badge.img+5
  • Author
  • New Contributor
  • April 8, 2014

Using the "-o" option, I've triggered:
Duplex/2-Sided Printing: None *DuplexNoTumble DuplexTumble
Option1/Duplexer: False *True

But, still no dice. Alas. Still hammering away.


Forum|alt.badge.img+5
  • Author
  • New Contributor
  • April 8, 2014

Nevermind, seems that I got it. For some reason, I have to run the following, twice, to get the Duplex option triggered...

do shell script "/usr/sbin/lpadmin -p Company_SecurePrint -E -v lpd://E123456@10.100.153.197/secureprint -E -D "Company SecurePrint" -m drv:///sample.drv/generic.ppd -o Duplex=DuplexTumble -o Option1=True"