Applescript will not run line pointing to network

kj0


Joined
Jun 1, 2009
Messages
12
Reaction score
0
Points
1
Location
Brisbane, Australia
Your Mac's Specs
MacBook | iMac | iPhone | iPod | eMac
HI All.

I've just written a small (Very Small) applescript to add a printer for those users we have here in our organisation that have a MacBook. We are primarily PCs so of course our printers are set up that way.

The issue I am having is when I point the line for the printer driver to a network location the script can not find that file, however, when I run the line for a local location it works and installs.

The network location is just a NAS with Everyone set to Full Permission.

Code:
do shell script "/usr/sbin/lpadmin -p QF_STAFFROOM -E -v lpd://<Server>.<Blah>.<blah>/P2132QF26D513/P2132QF26D513 -P smb://xx.xx.xxx.12/Printers/Dell_5130cdn.gz -D \"QF StaffRoom\""



IF I run this commend it works like a treat.

Code:
do shell script "/usr/sbin/lpadmin -p STAFFROOM -E -v lpd://<Server>.<Blah>.<blah>/P2132QF26D513/P2132QF26D513 -P /resources/Dell_5130cdn.gz -D \"StaffRoom\""



Thanks
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
Do you have to authenticate to access the Windows share?

Have you tried executing that command from the command line to see what errors (if any) are printed back?
 
OP
K

kj0


Joined
Jun 1, 2009
Messages
12
Reaction score
0
Points
1
Location
Brisbane, Australia
Your Mac's Specs
MacBook | iMac | iPhone | iPod | eMac
Yeap, Full access to that share. there is no authentication required.


lpadmin: Unable to open PPD file "smb://xx.xx.xxx.12/Printers/Dell_5130cdn.gz" - No such file or directory
 
OP
K

kj0


Joined
Jun 1, 2009
Messages
12
Reaction score
0
Points
1
Location
Brisbane, Australia
Your Mac's Specs
MacBook | iMac | iPhone | iPod | eMac
Ok.. I don't think I'm going to be able to do it via installing directly from a share, but what if I was to have it copy and create a folder and drop the file locally?

Code:
mount volume "smb://xx.xx.xxx.12/public/Printers"
tell application "Finder"
	duplicate every file of "Printers" to folder "resources" of home
end tell

However, I continue to get a "Can't ever every file from Printers" Error - There's only 1 file in that folder.

This script does connect to that share though. I'm thinking if I can run this as a two part script?



Thanks.
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
lpadmin: Unable to open PPD file "smb://xx.xx.xxx.12/Printers/Dell_5130cdn.gz" - No such file or directory
This error is quite specific - the file you're trying to copy over isn't available.

Also note that smb shares are mounted to /Volumes (it's this way at least if you do it through the GUI). Given that, it might actually be easier to write this as a shell script. Is there any particular reason you're using AppleScript?
 
OP
K

kj0


Joined
Jun 1, 2009
Messages
12
Reaction score
0
Points
1
Location
Brisbane, Australia
Your Mac's Specs
MacBook | iMac | iPhone | iPod | eMac
Given that, it might actually be easier to write this as a shell script. Is there any particular reason you're using AppleScript?

I was looking for idea's on how to write up a program in Xcode with Multiple buttons for each particular printer - I did some research and couldn't work it out with xcode4 (xcode3 was a lot easier) so I did a little more research and came across this complete Applescript. I just needed to fill in the details, however, the only bit I changed was to run it from a remote location.


Would it be easier to make the first step of the code to connect to the share and then the second part to link to /volumes?
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top