How to print to any printer from Classic Mac OS using macOS / X.

Slimes

Tinkerer
Jul 26, 2023
29
25
13
Canada
www.slimes.ca
How to print to any printer from Classic Mac OS using macOS / X.

I. From the macOS Terminal:

lpstat -p
Make note of the printer you want to use.
example: Brother_MFC_L2740DW_series

II. Open Script Editor on macOS / X. Input the following script:
________________________________________________________________________
on adding folder items to this_folder after receiving these_items
try
tell application "Finder"
repeat with i from 1 to number of items in these_items
try
set this_item to item i of these_items
set the path_string to this_item as string
set the final_path to quoted form of POSIX path of path_string
do shell script "/usr/bin/lp -d Brother_MFC_L2740DW_series " & final_path
move this_item to trash with replacing
on error error_message
tell application "Finder"
display dialog "Error for item " & (this_item as string) ¬
& ": " & error_message buttons {"Continue", "Cancel"} ¬
default button 1 giving up after 120
end tell
end try
end repeat
end tell
on error error_message
tell application "Finder"
display dialog error_message buttons {"Cancel"} ¬
default button 1 giving up after 120
end tell
end try
end adding folder items to
________________________________________________________________________

III. Save the script from II. into your
~/Library/Scripts/Folder Action Scripts folder.
If that folder doesn't exist, create it.

IV. Create a folder to attach the script made in II.
Right/CTRL click the folder and select Services->Folder Action Setup...

V. Select the script from the drop menu made in II.

VI. Setup an FTP server on macOS / X. I recommend QuickFTP from the App
Store. It doesn't require an install. Its just a simple App.

VII. Install an FTP client on your Classic Mac.

VIII. Connect to your macOS / X FTP server and upload the file into the
folder created in IV. It will print in a few seconds.
 
  • Like
Reactions: adamgracrrgv

V.Yakob

Tinkerer
Sep 6, 2023
63
26
18
I'll duplicate my message with Macos9lives.

I've always thought it should be like this: ~/Library/Workflows/Applications/Folder Actions/

You may like my rough code better.
:)


AppleScript:
property FileExt : {"docx", "doc", "pages", "pdf"}

on adding folder items to this_folder after receiving added_items
    repeat with AddedFiles in added_items
        set Printer to do shell script "lpstat -p | awk '{print $2}'"
        tell application "System Events"
            if the name extension of the AddedFiles is in (FileExt as list) then ¬
                set PrintingFile to (POSIX path of AddedFiles as text)
        end tell
        my StartPrint(Printer, PrintingFile)
    end repeat
end adding folder items to

on StartPrint(Printer, PrintingFile)
    set PushPrint to do shell script "/usr/bin/lp -d" & space & Printer & space & quoted form of PrintingFile
    set JobID to do shell script "echo" & space & quoted form of PushPrint & space & "| /usr/bin/awk '{print $3}'"
    my CheckPrint(JobID, PrintingFile)
end StartPrint

on CheckPrint(JobID, PrintingFile)
    set Filename to name of (info for (PrintingFile))
    repeat 5 times
        if (do shell script "lpstat -R | awk '{print$2}'") is not in JobID then
            display notification Filename with title "Printing from Mac OS 9" subtitle "successfully sent to print"
            do shell script "rm -f" & space & quoted form of PrintingFile
            exit repeat
        end if
        delay 1
    end repeat
    if (do shell script "lpstat -R | awk '{print$2}'") is in JobID then ¬
        display dialog "File " & quoted form of Filename & " was not printed" with title ¬
            "Printing from Mac OS 9" buttons {"OK"} default button 1 with icon stop giving up after 10
end CheckPrint
 
  • Like
Reactions: adamgracrrgv

Slimes

Tinkerer
Jul 26, 2023
29
25
13
Canada
www.slimes.ca
Nice! There most be proper script actions that could replace shell scripting, no? I wonder if AppleScript is being deprecated in favour of 'shortcuts'. Automator is now officially deprecated. It seems like everything historically good about MacOS is being removed. They should have went with BeOS and not NextCrap.
 

Slimes

Tinkerer
Jul 26, 2023
29
25
13
Canada
www.slimes.ca
Nice! There must be proper script actions that could replace shell scripting, no? I wonder if AppleScript is being deprecated in favour of 'shortcuts'. Automator is now officially deprecated. It seems like everything historically good about MacOS is being removed. They should have went with BeOS and not NextCrap. BeOS even had a trick where you could change the window manager to Platinum. Jean Louis Gasse blew it tho by asking for way too much money. They ended up hiring the dev who created BeFS to remake HFS tho.
 

V.Yakob

Tinkerer
Sep 6, 2023
63
26
18
@smiles,
I don't want to believe that AppleScript will be abandoned.
With the help of shortcuts you can do a lot of different cool actions, but the combination of shortcuts and AppleScript allows you to create quick actions that can't be created otherwise.
Again, AppleScript can be linked to the automation of folder actions, you can create services.
macOS will become poor without AppleScript.
Look at the forum, they work wonders with AppleScript. 💪🏻

P. S.
At the moment, the shortcuts cannot fully replace Automator.
 
  • Like
Reactions: adamgracrrgv

Slimes

Tinkerer
Jul 26, 2023
29
25
13
Canada
www.slimes.ca
Yeah, I know. its another failed attempt to make programming easier. well programming isn't easy. if it was, the world would be a very strange place indeed.

I grew up in the 80s. My esperience with simple programming was 12:00 clock flashers.

My dad came up with a novel solution; put black electrical tape over it.

It worked. including the bs crap in his cars. He was an automotive engineer at a big conglomerate. Simple solutions to simple problems.

Now everything is so ridiculous that I have purchased many old computers. The KGB went back to typewriters. The commist gov. in China has banned all NA based phones. There is a reason why.
 
Last edited:

Slimes

Tinkerer
Jul 26, 2023
29
25
13
Canada
www.slimes.ca
BTW, the script is a folder action; ftp is for MacOS 9 and below to be able to easily drop a file into the scripted folder. It even works with my Citizen Dot Matrix printer without issues. We all know how well supported dot matrix is in classic MacOS...
 

adamgracrrgv

New Tinkerer
Oct 12, 2023
9
3
3
As far as I know, printing from classic Mac OS is a bit difficult, but you might find it useful, you can try the following steps:
First, you need shared access to the printer in macOS / OS X
and secondly to configure the classic Mac OS.
 

trag

Tinkerer
Oct 25, 2021
280
133
43
Nice workaround for modern printers.
Is there a way to get my ImageWriter to print over Wi-Fi with my BlueSCSI Wi-Fi enabled 68K macs?

I may be overlooking something, but it seems to me that your Wi-Fi enabled 68K Macs can access your wired network through their Wi-Fi connection. So if you add an ethernet to LocalTalk bridge, such as the AsanteTalk, to your network, and install the LocalTalk option in the Imagewriter, that should do the trick.

Oh, that would work for an Imagewriter II. If you have an original Imagewriter, then there's no LocalTalk option available, I believe, so that may have been a waste.