Reputation: 1
Trying to compile an add printer command using lpadmin and running it via an Apple Script. The issue I am facing is the printer name has the special Character & and looks like this
PRINTERVALUE: DellB&W
do shell script "lpadmin -p " & PRINTERVALUE & " -E -v LPD://" & PRINTERVALUE & " -P /Library/Printers/PPDs/Contents/Resources/DellBW.ppd.gz -o printer-is-shared=false"
This gives me an error and the command halts at special character & since is part of the Printer name.. Any ideas ?
Upvotes: 0
Views: 121
Reputation: 285069
Use quoted form of
, it adds the necessary escape characters:
do shell script "lpadmin -p " & quoted form of PRINTERVALUE & " -E -v LPD://" & quoted form of PRINTERVALUE & " -P /Library/Printers/PPDs/Contents/Resources/DellBW.ppd.gz -o printer-is-shared=false"
Upvotes: 3
Reputation: 143
In general escape char is: \
Try something like this:
PRINTERVALUE: DellB\&W
or in quotes:
PRINTERVALUE: "DellB\&W"
Upvotes: -1