Mac Forums

Mac Forums (http://www.mac-forums.com/forums/)
-   OS X - Development and Darwin (http://www.mac-forums.com/forums/os-x-development-darwin/)
-   -   Applescript will not run line pointing to network (http://www.mac-forums.com/forums/os-x-development-darwin/274079-applescript-will-not-run-line-pointing-network.html)

kj0 05-03-2012 09:52 PM

Applescript will not run line pointing to network
 
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 05-03-2012 10:27 PM

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?

kj0 05-03-2012 10:43 PM

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

kj0 05-04-2012 01:59 AM

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 05-04-2012 12:14 PM

Quote:

Originally Posted by kj0 (Post 1401558)
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?

kj0 05-05-2012 02:13 AM

Quote:

Originally Posted by vansmith (Post 1401702)
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?


All times are GMT -4. The time now is 07:13 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.