Skip to content

Add -o option to set the printer (.PRN) output folder#45

Closed
emendelson wants to merge 0 commit into
cracyc:vtfrom
emendelson:vt
Closed

Add -o option to set the printer (.PRN) output folder#45
emendelson wants to merge 0 commit into
cracyc:vtfrom
emendelson:vt

Conversation

@emendelson

Copy link
Copy Markdown

This is a proof-of-concept created by Claude Code, and I'm offering it only to suggest a feature that might be worth adding: a way to redirect LPT output to a specified folder, so a folder-watcher can process it.

msdos-player already writes LPT1/2/3 output to timestamped .PRN files in %TEMP%. The propsed new -o= option redirects them to a chosen folder so a single directory can be watched and post-processed.

This is from Claude Code:

The folder value is expanded with ExpandEnvironmentStringsA at write time (so -o=%TEMP%\msdos resolves per machine) and created on demand, parents included. When combining a command file with -c, the folder is stored in the .msdos section via a spare flags2 bit (0x20) plus a length-prefixed string, so it is restored when the combined executable runs. The bit and trailing data are ignored by older builds, so the format stays backward compatible.

Again, I don't pretend to understand the code, but I hope you'll think the general idea is worth having. There's already an issue asking for the same thing.

@cracyc

cracyc commented Jun 25, 2026

Copy link
Copy Markdown
Owner

I'm not a huge fan of doing it this way although I also don't like whats there now, most users are not going to have any idea what happened to the file they try to print. Most people will think it just doesn't work. Even it they do find it if it's a postscript or PCL file most won't know what to do with it. It would of course be better to send it to the print spooler but unless things are set up properly with the correct driver, which is unlikely, it's not going to work either. What would be nice is a simple daemon which listens on a socket sort of like lpd that can then try to handle it properly by sending to a printer if possible or save it where the user will be able to find it.

@emendelson

Copy link
Copy Markdown
Author

Understood. If that daemon existed, it would be great, but I've never found an open-source or freeware one. I have an AutoIt folder-watcher that prints PCL, PS, and text, and would work with this redirect method. But it's too elaborate for everyday users: https://mendelson.org/printfileprinter.html

@cracyc

cracyc commented Jun 26, 2026

Copy link
Copy Markdown
Owner

https://mendelson.org/printfileprinter.html

That doesn't seem too complex since you've got an installer. Doesn't it work if you point it at the user temp directory since the files created by msdos-player have a prn extension? I've never used autoit but it does look like it supports listen sockets, https://www.autoitscript.com/autoit3/docs/functions/TCPListen.htm, should be possible to send it a file then it can put it anywhere you want.

@emendelson

Copy link
Copy Markdown
Author

I didn't realize that AutoIt supported listen sockets, and obviously I should have thought of that. Thank you! Meanwhile, I can't use my PrintFilePrinter as written, because it looks for .tmp files and the %temp% folder has dozens of them. My PrintFilePrinter is designed to focus on a single-use directory, but I could easily rewrite it to look only for .prn files in %temp% or anywhere else.

Meanwhile, I'll check up on TCPlisten. Thank you again!

@emendelson

Copy link
Copy Markdown
Author

I rewrote my PrintFilePrinter so that it has an option to look for only one extension (like .prn). This makes it work perfectly with msdos-player. So all is well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants