Print from OS 9 to an OS X network printer via AppleScript

Oct 14, '03 10:38:00AM

Contributed by: mmichaelmmorriso

I've tried for quite some time to get my files to print from my wife's iBook (clamshell) running OS 9.2 to the Epson Inkjet or HP Laserjet 4 on our network. The HP is directly connected to the ethernet hub and the Epson is connected to the OS X iMac via USB. I've tried using this hint, but it doesn't work, and I scoured the internet with no result. Yet, there is a simple, if not particularly elegant, way.

I've written a very simple AppleScript and attached it to my drop box folder on the OS X machine. I've placed an alias of the drop box on the desktop of the OS 9 machine (set to appear on start up). When the user of the OS 9 machine drops a file into the drop box, the Applescript is activated and the finder prints the file to the default printer.

Read the rest of the hint for the how-to...

Here's what you need to do...

  1. Create this simple Applescript:
    
    on adding folder items to this_folder after receiving these_items
      tell application "Finder"
        --this prints the item(s) dropped into the drop box
        print these_items 
        -- this pauses the process until the printer has time
        -- to print (make it longer if you wish)
        delay 50 
        -- this deletes the files after printing - keeps folder clean
        delete these_items
      end tell
    end adding folder items to
    
  2. Put this script (I call it droptoprint) in /Library -> Scripts -> Folder Action Scripts). Using folder actions, attach this script to your Drop Box folder in the Public folder of your home folder on the OS X machine. Of course, you must have script menu and folder actions enabled (Script menu is a folder called Script Menu.menu in your AppleScript folder, or can be downloaded here. You must drag the Script Menu.menu to your menu bar to activate). Go to the Enable Folder Actions item in the Folder Actions submenu to start folder actions. Then choose Attach Script to Folder in the same submenu. Select the script and attach.

  3. Mount the OS X machine's drop box on the OS 9 machine's desktop. To do so go to the Chooser, select AppleShare and log onto the OS X machine's hard drive (as guest) and have the drive mount to the desktop at startup (of course Personal File Sharing must be started on the OS X machine). Make an alias of the drop box and put it on the OS 9 desktop.

  4. When the OS 9 user wishes to print have them either 1) print to a file and drop the resulting file into the drop box or 2) drop an existing file into the drop box.
One limitation: the OS X machine must have an application that supports that file -- e.g. if you have AppleWorks on your OS 9 laptop but not on your OS X desktop, then it won't print. Remember that this will print and delete everything dropped into your drop box!

Comments (7)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20031012122716423