IP Print setup using desktop print manager
IP Print setup using desktop print manager
- Subject: IP Print setup using desktop print manager
- From: "Pete Willis" <email@hidden>
- Date: Fri, 19 Jan 2001 18:07:51 +0000
I have been trying to write a script that will allow our users to select an IP Printer from a list. Desktop print Manager will then setup this printer up using the IP Address via LPR printing. The script works fine for setting up the printers. a desktop printer is built and the printer prints fine.
On running the script again (or having a repeat statement for multiple selections in the first run) the second printer that is setup wont print. The desktop printer sets up with no errors and the script finishes but if you print to it I get an error -8927. Restarting the Mac Deleting all the printers and setting up the printer causing no error. This is the only way to get it to work.
the basis of the script is as follows (which I got from the applescript guidebook help module)
--
set printer_list to {list of printer Names}
set printerAddress to {list of printer IP Numbers}
set PPD_name to {list of PPD's}
set drivername to "laserwriter 8"
tell application "Finder"
set chooseprinter to choose from list *
printer_list with prompt "Please Select the Printers to Install" with multiple selections allowed
end tell
repeat with i in chooseprinter
try
set the PPD_list to list folder (path to printer descriptions) without invisibles
if the PPD_list contains the PPD_name then
try
set the PPD_file to ((the path to printer descriptions as text) & the PPD_name) as alias
tell application "Desktop Printer Manager"
make new desktop printer at desktop with properties *
{name:printerName, is default:true *
, PPD file:the PPD_file, address:*
{class:address specification, ID:the printerAddress, protocol:IP} *
, driver name:the driverName}
end tell
on error
try
tell application "Desktop Printer Manager"
set the PPD file of the default printer to the PPD_file
end tell
on error the errmsg number the errnum
error ("There was an error setting up printer " & i as string) & return & errmsg & " : Error Code - " & errnum
end try
end try
else
error "The correct printer description is not installed for printer " & i as string
end if
on error the errmsg
display dialog the errmsg buttons ("ok") default button 1
end try
end repeat
--
If i set up the printers manually using desktop printer utility I have no problem with multiple printers, it just seems to be via applescript that a problem occurs.
I have looked everywhere to find what error code -8927 means but with no luck. This is really becoming frustrating and not sure if it is a but with desktop print manger (I have increased the memory size for the addition).
I am running OS9.04
Any help would be most appreciated
thanks in advance
Pete
email@hidden