Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Print from Classic using native OS X printer drivers' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Print from Classic using native OS X printer drivers
Authored by: srmtlm on Mar 30, '05 06:08:47PM

I modified the script so that a specific printer is actually set in the script instead of displaying the dialog box to select a printer. The problem is it prints to that printer and then the script seems to get stuck. As folder actions quits responding and I have to force the system events to quit before I can get the folder actions to work again. Below is the script as I modified it. Being as I'm new to scripting I probably have some lines of code that aren't needed. Any help is appreciated. Thanks.

on adding folder items to this_folder after receiving added_items
set the_file to item 1 of added_items
-- the_file=file name placed in folder
if the_file is not ".DS_Store" then
-- check to make sure the file in the folder is no .DS_Store
set file_info to the info for the_file
-- file_info=file information of file placed in folder
set file_name to the name of file_info
-- file_name=name derived from file information of file placed in folder
set file_path to the POSIX path of the_file
-- file_path=unix path to the_file which is the postscript file placed in folder
set printer_path to path to home folder as text
-- printer_path=path to home but as text
set printer_path to printer_path & "Library:Printers:"
-- printer_path=path to home plus :Library:Printers:
set printer_list to list folder printer_path
-- printer_list=list of printer files in home:Library:Printers directory
set printer_names to {}
-- printer_names=nothing I guess
-- The next setting is the setting for which printer you want the file to come out of
set the_printer to "Phaser7300"
repeat with i from 1 to number of items in printer_list
set the_item to item i of printer_list
if the_item is not ".DS_Store" then
set item_name to text of characters 1 through ((length of the_item) - 4) of (the_item as string) as string
set printer_names to printer_names & item_name
end if
end repeat
if length of printer_names is 0 then
display dialog "No printers available. Print job canceled." buttons {"OK"} with icon caution default button 1
if the_printer is not false then
set printer_path to printer_path & the_printer & ".app:Contents:MacOS:PrinterProxy" as alias
set printer_path to POSIX path of printer_path
do shell script "\"" & printer_path & "\" \"" & file_path & "\"; rm \"" & file_path & "\""
do shell script "rm \"" & file_path & "\""
end if
end if
end if
end adding folder items to

[ Reply to This | # ]