|
Adding smb (samba) printers can be painful and hard for many Mac users. This script makes it eaiser for printing to windows print servers. You MUST customize the script to your network. Change the server address and location in the "do shell script" command.
--GET USERNAME AND PASSWORD
to getusername()
display dialog "Enter your username:" default answer ""
set username to text returned of result
return {username}
end getusername
to getadminpwd()
display dialog "Enter your password:" default answer "" with hidden answer
set adminpwd to text returned of result
return {adminpwd}
end getadminpwd
set username to getusername()
set adminpwd to getadminpwd()
-- SET MISC VARIABLES
tell application "Finder"
set mydisk to get name of startup disk
end tell
set ppdDefaultLocation to mydisk & ":Library:Printers:PPDs:Contents:Resources:en.lproj:"
set printersInstalled to "Printers Installed:"
--FUNCTION THAT RUNS SHELL SCRIPT TO ADD THE PRINTERS
to addprinter(ppd, username, adminpwd, printerName, printersInstalled)
set ppdPath to POSIX path of ppd
try
do shell script "lpadmin -p" & printerName & " -vsmb://" & username & ":" & adminpwd & "@SERVER/ADDRESS/" & printerName & " -E -P" & quoted form of ppdPath & " -LLOCATION -D'" & printerName & "'"
set printersInstalled to return & printerName & " Successful"
on error
set printersInstalled to return & printerName & " Failed"
end try
return printersInstalled
end addprinter
repeat
display dialog "Enter printer queue name. You must be EXACT!" default answer ""
set printerName to text returned of result
set ppd to choose file default location alias ppdDefaultLocation
set printersInstalled to printersInstalled & addprinter(ppd, username, adminpwd, printerName, printersInstalled)
display dialog "Would you like to add another printer?" buttons {"Yes", "No"} default button "No"
if button returned of result is "No" then
exit repeat
end if
end repeat
display dialog printersInstalled buttons {"OK"} default button "OK"
Add as favourites (227) | Quote this article on your site | E-mail
Only registered users can write comments. Please login or register. Powered by AkoComment Tweaked Special Edition v.1.4.4 |