joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.68k stars 381 forks source link

macOS no longer supports postscript files #4669

Open ezathashim opened 9 months ago

ezathashim commented 9 months ago

Is your feature request related to a problem? Please describe.

MacOS no longer supports Postscript files. The available settings in dosbox-x include:

printoutput: Output method for finished pages: png : Creates PNG images (default) ps : Creates PostScript bmp : Creates BMP images (very huge files, not recommended)

It would be good to have a PDF output instead of ps because of the limitations in modern macOS.

What you want

it would be good if printoutput had a 'pdf' output. I'm not an expert, but I imagine that the ps file would somehow get converted to the final PDF. Hopefully there is an open-source script that can be used to perform the conversion. Ghostscript might have something that can be used, but I'm not sure how to use it.

If PDF output is available, then it can be opened using 'Preview.app'.

Describe alternatives you've considered

Additional information

No response

Have you checked that no similar feature request(s) exist?

Code of Conduct & Contributing Guidelines

rderooy commented 9 months ago

Interesting. I guess in that case macOS users are in the same boat as Windows users. You will have to install a 3rd party app that can handle Postscript.

ezathashim commented 9 months ago

I have a cumbersome workaround using this app:

https://mendelson.org/postscripttopdf.html

Basically, I generate a 'ps' file and set the dosbox-x config parameter to:

openwith = open -s "PostScriptToPDFDelete"

I also set the default app for 'ps' file on macOS to PostScriptToPDFDelete. The PS then gets converted to a PDF. I then have to manually open the PDF, though.

joncampbell123 commented 9 months ago

I suppose as a quick hack, DOSBox-X PDF output could produce a PS file, then run the "ps2pdf" tool to produce a PDF.

For Windows and Mac OS it would have to provide that with itself somehow, while on Linux it probably exists as one of the tools in /usr/bin/

https://linux.die.net/man/1/ps2pdf

joncampbell123 commented 9 months ago

The longer term solution is to implement a PDF writer. PDF isn't all that difficult to figure out. It's basically a tree of objects of various types that describe a document, it's pages, contents, images, etc. in a file.

http://hackipedia.org/browse.cgi/File%20formats/PDF%2c%20Portable%20Document%20Format

joncampbell123 commented 9 months ago

As a final method for Mac OS users, I think it has (or had?) a built-in printer driver that prints to PDF. Perhaps that could be an option?

ezathashim commented 9 months ago

I think the latest macOS has absolutely no support for Postscript, including lack of ps2pdf. I don't even think the printer engine can interpret ps files at this point.

rderooy commented 9 months ago

On my Linux system...

$ rpm -q --whatprovides $(which ps2pdf)
ghostscript-10.02.1-2.fc39.x86_64

Perhaps installing ghostscript via brew would help?

ezathashim commented 9 months ago

Yes, thanks I did use HomeBrew to install it. It would be nice to actually have a built-in ps-> pdf generator in DosBox-X, though, especially since postscript seems to be almost completely legacy on most OSs at this point.

Maybe whatever API is used to generate the ps file could have a code path to generate a PDF directly instead?

emendelson commented 9 months ago

pstopdf no longer exists in macOS. The only practical solution is to install Ghostscript (the gs executable) and run a command that converts ps output to pdf format. In all my DOSBox-X-based macOS apps, I have lpt1, etc., set to printps to a shell script that runs gs with the command to create PDF output.

I don't think DOSBox-X should try do any of this natively, because it's too complex to set up without an AppleScript wrapper like the one I use in my DOSBox-X-App:

https://mendelson.org/dosboxapp.html

emendelson commented 9 months ago

I have a cumbersome workaround using this app:

https://mendelson.org/postscripttopdf.html

Basically, I generate a 'ps' file and set the dosbox-x config parameter to:

openwith = open -s "PostScriptToPDFDelete"

I also set the default app for 'ps' file on macOS to PostScriptToPDFDelete. The PS then gets converted to a PDF. I then have to manually open the PDF, though.

@ezathashim - I've modified the app so that (by default) it opens the PDF file in the default PDF viewer, but I want to make a few more refinements before releasing the new version.

emendelson commented 9 months ago

@ezathashim - I've revised my app so that it does more of what you need. Meanwhile, this shell script will convert a PS file to a PDF file (overwriting an existing PDF) and open it in the default PDF reader.

Replace /path/to/gs with the actual path to the gs executable. Save the file as a shell script; use chmod +x to make it executable. Run it with a PS file as the command-line parameter.

#!/bin/sh
FILEPATH="$1"
OUTPATH="${FILEPATH%.*}.pdf"
/path/to/gs -dEPSCrop -sBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile="$OUTPATH" "$FILEPATH"
open "$OUTPATH"
ezathashim commented 9 months ago

This is great!

I have managed to run the gs line manually in Terminal. However, I have not beed able to figure out what config parameters need to be changed in the DOsBox Preferences file. I tried:

docpath = /Users/ezat/Documents/nv/DosBoxPrintouts fontpath = /System/Library/Fonts openwith = /Users/ezat/Documents/nv/DosBox\ Setup/gs_ps_to_pdf.sh

Is ‘openwith’ where I need to add the location of the shell script? I’m attaching the shell file in case you find something wrong with it.

Thanks!

On Dec 15, 2023, at 10:15 PM, emendelson @.***> wrote:

@ezathashim https://github.com/ezathashim - I've revised my app so that it does more of what you need. Meanwhile, this shell script will convert a PS file to a PDF file (overwriting an existing PDF) and open it in the default PDF reader.

Replace /path/to/gs with the actual path to the gs executable. Save the file as a shell script; use chmod +x to make it executable. Run it with a PS file as the command-line parameter.

!/bin/sh

FILEPATH="$1" OUTPATH="${FILEPATH%.*}.pdf" /path/to/gs -dEPSCrop -sBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile="$OUTPATH" "$FILEPATH" open "$OUTPATH" — Reply to this email directly, view it on GitHub https://github.com/joncampbell123/dosbox-x/issues/4669#issuecomment-1858697148, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABI7U536DYHWZS7VAHJT5VTYJUG43AVCNFSM6AAAAABAQKW7UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJYGY4TOMJUHA. You are receiving this because you were mentioned.

emendelson commented 9 months ago

My setup is a lot more complicated, and I use lpt3 for creating a PDF (you'll probably use lpt1) , but, briefly, you need something like this in the conf file. The only relevant parts for you are the file file:... string, where you specify the name and path of the output file (adjust the path to match your setup) and the openps: string, where you specify the location of the script and the name of the output file that you will send to the script as a parameter:

[parallel]
parallel3 = file file:../../../writepdf.prn timeout:1000 openpcl:"../../../pclpdf.sh writepdf.prn" openps:"../../../pspdf.sh writepdf.prn" openwith:"../../../texttopdf.sh writepdf.prn"

And here is my script, which is a lot more complicated than you need, because I use it for PCL and PS output, and also for parsing a file that I create from WordPerfect to assign a name and location for the PDF. (I had to add a .txt extension in order to upload it, but its name should just be pspdf.sh to match the string in the conf file.

pspdf.sh.txt

Something much simpler than this could be used as the default openps: setup if gs is included in the DOSBox-X app bundle, but this would have to be used for macOS builds only, so things would get complicated. Maybe the wiki could give instructions for the few users who need to create a PDF from PostScript output in macOS.

rderooy commented 9 months ago

I can update the wiki page for macOS. Do you know with which macOS release that the old method stopped working?

I can also add some instructions for newer macOS releases if someone gives me some text to add. Since I don't have a mac myself, I don't feel qualified to write about it.

rderooy commented 9 months ago

It seems "preview" support for postscript was removed in "Ventura". https://appleinsider.com/articles/22/10/26/apple-drops-postscript-support-in-preview-for-macos-ventura

ezathashim commented 9 months ago

For sure, Postscript is dead on Sonoma (macOS 14), but I have a computer using Ventura (macOS 13) that has the same problem.

On Dec 16, 2023, at 10:01 AM, Robert @.***> wrote:

I can update the wiki page for macOS. Do you know with which macOS release that the old method stopped working?

I can also add some instructions for newer macOS releases if someone gives me some text to add. Since I don't have a mac myself, I don't feel qualified to write about it.

— Reply to this email directly, view it on GitHub https://github.com/joncampbell123/dosbox-x/issues/4669#issuecomment-1858838158, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABI7U562YFZME4NG4XTOESDYJWZTRAVCNFSM6AAAAABAQKW7UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJYHAZTQMJVHA. You are receiving this because you were mentioned.

ezathashim commented 9 months ago

I’m unable to understand the code in the DOSBox-X project since my only expertise is in Swift, SwiftUI and Objective-C.

However, I have asked a good friend of mine who is extremely comfortable with this code pattern to have a look and see if he can embed the GS files in the app and have a path code to generate a PDF from within the app. I’m not sure if the relevant GS files are platform-agnostic, though.

If it is easy, I ask him to do the changes on my coin and do a pull-request. I’ll keep you apprised.

If this works, it will avoid a lot of frustration and support emails.

On Dec 16, 2023, at 10:02 AM, Robert @.***> wrote:

It seems "preview" support for postscript was removed in "Ventura". https://appleinsider.com/articles/22/10/26/apple-drops-postscript-support-in-preview-for-macos-ventura

— Reply to this email directly, view it on GitHub https://github.com/joncampbell123/dosbox-x/issues/4669#issuecomment-1858838549, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABI7U5YT66KCNCEXOGB2VT3YJWZ2DAVCNFSM6AAAAABAQKW7UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJYHAZTQNJUHE. You are receiving this because you were mentioned.

ezathashim commented 9 months ago

Maybe I’m dumb, but if I set the output to png, this can be opened in Preview.

Is there a disadvantage on using a PNG file rather than a Postscript file or PDF?

On Dec 16, 2023, at 10:13 AM, Ezat Hashim @.***> wrote:

I’m unable to understand the code in the DOSBox-X project since my only expertise is in Swift, SwiftUI and Objective-C.

However, I have asked a good friend of mine who is extremely comfortable with this code pattern to have a look and see if he can embed the GS files in the app and have a path code to generate a PDF from within the app. I’m not sure if the relevant GS files are platform-agnostic, though.

If it is easy, I ask him to do the changes on my coin and do a pull-request. I’ll keep you apprised.

If this works, it will avoid a lot of frustration and support emails.

  • Ezat

On Dec 16, 2023, at 10:02 AM, Robert @.***> wrote:

It seems "preview" support for postscript was removed in "Ventura". https://appleinsider.com/articles/22/10/26/apple-drops-postscript-support-in-preview-for-macos-ventura

— Reply to this email directly, view it on GitHub https://github.com/joncampbell123/dosbox-x/issues/4669#issuecomment-1858838549, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABI7U5YT66KCNCEXOGB2VT3YJWZ2DAVCNFSM6AAAAABAQKW7UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJYHAZTQNJUHE. You are receiving this because you were mentioned.

emendelson commented 9 months ago

Maybe I’m dumb, but if I set the output to png, this can be opened in Preview. Is there a disadvantage on using a PNG file rather than a Postscript file or PDF?

Does PNG let you output more than one page? If you only plan to print a single page, PNG will be fine.

emendelson commented 9 months ago

However, I have asked a good friend of mine who is extremely comfortable with this code pattern to have a look and see if he can embed the GS files in the app and have a path code to generate a PDF from within the app. I’m not sure if the relevant GS files are platform-agnostic, though.

It's easy to embed gs or any other file in a macOS app. But gs for macOS won't work on any other platform, so the conf file can't use it by default.

rderooy commented 9 months ago

png will generate a single png per page, which may be a bit messy if your printing a multi-page document. I'm also not sure if the dimensions of the png are kept to "page size".

emendelson commented 9 months ago

I've created a fork of the project that does a few things under macOS:

  1. It sets the default folder for the conf file as the Resources older of dosbox-x.app, and copies the reference conf file into it as dosbox-x.conf
  2. It copies the gs and gpcl6 executables into the Resources folder. gpc6 converts PCL printer output into PDF.

What I can't figure out is how to hard-code the default working directory, and that's the crucial thing to do....

Next, if I can figure out how to hard-code the working directory, I'll revise the scripts I use to convert PS and PCL output to PDF and add those, and revise the conf file to us the scripts when printing.

Code:

https://github.com/emendelson/dosbox-x/commits/master/

To build, run ./build-macos and then make dosbox-x.app.

emendelson commented 9 months ago

OK, have solved the problem of making the working directory be the Resources folder in the macOS app. What it needed was a slightly modified conf file copied into the app during the build. This now prints and creates PDFs from text, PCL, and PostScript output. Printing to LPT1 prints to the default macOS printer; printing to LPT3 creates a PDF on the host desktop.

emendelson commented 9 months ago

@ezathashim - You can build DOSBox-X for macOS using the code on my fork, and it should print/create-PDF correctly for text files, PostScript, and PCL output.

ezathashim commented 9 months ago

Awesome! I’ll give it a whirl and send some feedback.Thanks!- EzatOn Dec 17, 2023, at 8:57 PM, emendelson @.***> wrote: @ezathashim - You can build DOSBox-X for macOS using the code on my fork, and it should print/create-PDF correctly for text files, PostScript, and PCL output.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

ezathashim commented 9 months ago
  1. I tried to use the command './build-macos universal’ and it fails. This also occurs on the joncampbell GitHub repo. I had to use './build-macos’. Is there a different command for a universal compilation?

  2. I’m not sure why, but when I launch, the app fails to use the [autoexec] entries in my preferences file.

On Dec 17, 2023, at 8:59 PM, Ezat Hashim @.***> wrote:

Awesome! I’ll give it a whirl and send some feedback.

Thanks!

  • Ezat

On Dec 17, 2023, at 8:57 PM, emendelson @.***> wrote:



@ezathashim https://github.com/ezathashim - You can build DOSBox-X for macOS using the code on my fork, and it should print/create-PDF correctly for text files, PostScript, and PCL output.

— Reply to this email directly, view it on GitHub https://github.com/joncampbell123/dosbox-x/issues/4669#issuecomment-1859421941, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABI7U5ZHP44MEZ525QGQVALYJ6PIFAVCNFSM6AAAAABAQKW7UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJZGQZDCOJUGE. You are receiving this because you were mentioned.

emendelson commented 9 months ago
  1. I tried to use the command './build-macos universal’ and it fails. This also occurs on the joncampbell GitHub repo. I had to use './build-macos’. Is there a different command for a universal compilation? 2. I’m not sure why, but when I launch, the app fails to use the [autoexec] entries in my preferences file. - Ezat

@ezathashim -

  1. ./build-macos universal doesn't work except in VERY special circumstances.

  2. For my code, the prefs file is inside the app, in the Resources folder. Add your autoexec entries there. Printing will only work with the [parallel] code in my prefs file.

ezathashim commented 9 months ago

Ok, I got it to run, but when I try to print from the DOS app I’m using, nothing happens. Is there something I need to setup? In my ‘usual’ settings, I do this:

parallel1 = printer . . .

printer = true dpi = 360 width = 85 height = 110 printoutput = ps multipage = true device = - docpath = /Users/ezat/Documents/nv/DosBoxPrintouts fontpath = /System/Library/Fonts openwith = open -s "Preview" openerror = printdbcs = auto shellhide = false timeout = 1000

On Dec 18, 2023, at 2:09 PM, emendelson @.***> wrote:

I tried to use the command './build-macos universal’ and it fails. This also occurs on the joncampbell GitHub repo. I had to use './build-macos’. Is there a different command for a universal compilation? 2. I’m not sure why, but when I launch, the app fails to use the [autoexec] entries in my preferences file. - Ezat ./build-macos universal doesn't work except in VERY special circumstances.

For my build, the prefs file is inside the app, in the Resources folder. Add your autoexec entries there.

— Reply to this email directly, view it on GitHub https://github.com/joncampbell123/dosbox-x/issues/4669#issuecomment-1861369846, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABI7U5YAG5RZBW5MILRAJQDYKCIFRAVCNFSM6AAAAABAQKW7UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRRGM3DSOBUGY. You are receiving this because you were mentioned.

emendelson commented 9 months ago

@ezathashim Please read the dosbox-x.conf file in the Resources folder

ezathashim commented 9 months ago

Yes, I did that and I saw this line:

parallel1 = file file:temp.prn timeout:1000 openwith:"./texttoprinter.sh temp.prn" openpcl:"./printpcl.sh temp.prn" openps:"./psprint.sh temp.prn"

Since my app uses parallel1, I’m assume this line should work for me. Is there anything I’m forgetting?

On Dec 18, 2023, at 8:03 PM, emendelson @.***> wrote:

@ezathashim https://github.com/ezathashim Please read the dosbox-x.conf file in the Resources folder

— Reply to this email directly, view it on GitHub https://github.com/joncampbell123/dosbox-x/issues/4669#issuecomment-1861934335, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABI7U52EJJI3BSYMDDZ6OZLYKDRWZAVCNFSM6AAAAABAQKW7UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRRHEZTIMZTGU. You are receiving this because you were mentioned.

emendelson commented 9 months ago

@ezathashim - Please try it and come back with any questions. (Of course it will ONLY work with the app that you built from my code.)

ezathashim commented 9 months ago

Yes. The UI does a little flicker so I assume something is happening, but no printer panel or anything else shows up.

Maybe there’s a permissions issue?

On Dec 19, 2023, at 7:29 AM, emendelson @.***> wrote:

@ezathashim https://github.com/ezathashim - Have you tried it?

— Reply to this email directly, view it on GitHub https://github.com/joncampbell123/dosbox-x/issues/4669#issuecomment-1862672783, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABI7U55EN3YYN6PI5NL3G7LYKGCD5AVCNFSM6AAAAABAQKW7UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRSGY3TENZYGM. You are receiving this because you were mentioned.

emendelson commented 9 months ago

@ezathashim - I corrected a few errors in my code, so please download the current version and build with this command:

./build-macos-app

or

/build-macos-sdl2-app

The executable will open after it is built. DO NOT MAKE ANY CHANGES IN THE APP BEFORE TRYING THE FOLLOWING:

At the DOSBox prompt, enter:

dir>lpt1

If it does not print, then you may not have a default printer in macOS. Set a default printer and try again.

Then enter:

dir>lpt2

The directory should open in a temporary PDF in Preview. It will be deleted automatically.

Then enter:

dir>lpt3

and a PDF should be written to your desktop.

Mount whatever folder contains your DOS applications, and try printing PostScript or PCL output.

Again, nothing will print if you do not have a default printer set in macOS. EDIT: I've written a popup that explains this if no default printer is present.

emendelson commented 9 months ago

And I've now added a "print to macOS clipboard" feature. Print to LPT4, and the text will go to the macOS clipboard. This works for plain text, PostScript, and PCL output.

ezathashim commented 9 months ago

dir>lpt1

This did not work. I did notice that my default printer is set to ‘Last Printer Used’. Maybe directing the output to a printer is not a good one because it will cause a lot of confusion and support emails. Then enter:

dir>lpt2

This worked perfectly. Then enter:

This worked perfectly.

I set the print output in the DOS app I’m using to LPT2 and it worked perfectly by opening Preview with the output.

Amazing!

On Dec 19, 2023, at 3:41 PM, emendelson @.***> wrote:

@ezathashim https://github.com/ezathashim - I corrected a few errors in my code, so please download the current version and build with this command:

./build-macos-app

or

/build-macos-sdl2-app

The build will open. At the DOSBox prompt, enter:

dir>lpt1

If it does not print, then you may not have a default printer in macOS. Set a default printer and try again.

Then enter:

dir>lpt2

The directory should open in a temporary PDF in Preview. It will be deleted automatically.

Then enter:

dir>lpt3

and a PDF should be written to your desktop.

Mount whatever folder contains your DOS applications, and try printing PostScript or PCL output.

Again, nothing will print if you do not have a default printer set in macOS. Someday I'll add a popup that explains this if no default printer is present.

— Reply to this email directly, view it on GitHub https://github.com/joncampbell123/dosbox-x/issues/4669#issuecomment-1863443656, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABI7U53WVY35NNVNZFI5XPTYKH3XZAVCNFSM6AAAAABAQKW7UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRTGQ2DGNRVGY. You are receiving this because you were mentioned.

emendelson commented 9 months ago

@ezathashim

dir>lpt1 This did not work. I did notice that my default printer is set to ‘Last Printer Used’. Maybe directing the output to a printer is not a good one because it will cause a lot of confusion and support emails.

I'm puzzled by this. Could you open a terminal in macOS, enter the following command, and tell me what you see:

lpq

When I set up my system to use the "last printer used", dir>lpt1 works correctly. I would be curious to know what might go wrong.

My latest code makes some minor fixes, and adds the ability to "print" to the macOS clipboard by printing to LPT4. It also shows an error message if it can't find a default printer.

ezathashim commented 9 months ago

If I do the terminal command:

MBP-M1Max-16:dosbox-x-master ezat$ lpq HP_Color_LaserJet_Pro_M453_4 is ready and printing Rank Owner Job File(s) Total Size active ezat 107 temp.pdf 6144 bytes 1st ezat 108 temp.pdf 6144 bytes 2nd ezat 109 temp.pdf 6144 bytes 3rd ezat 110 temp.pdf 6144 bytes 4th ezat 111 temp.pdf 6144 bytes 5th ezat 112 temp.pdf 9216 bytes

It seems like it might be waiting until I’m at the network where that printer is. I’m at home now and that printer is at the office. In fact, I have a bunch of printers set up at the office and none at home.

I guess it does use the ‘last printer’ and puts things in a queue when the printer is readily available,

Is there a command you can use to determine if the printer is available or not, and post an alert if none are available?

On Dec 20, 2023, at 2:43 PM, emendelson @.***> wrote:

@ezathashim https://github.com/ezathashim dir>lpt1 This did not work. I did notice that my default printer is set to ‘Last Printer Used’. Maybe directing the output to a printer is not a good one because it will cause a lot of confusion and support emails.

I'm puzzled by this. Could you open a terminal in macOS, enter the following command, and tell me what you see:

lpq

It's possible that the macOS lpr command won't work with your printer, but that seems unlikely.

When I set up my system to use the "last printer used", dir>lpt1 works correctly. I would be curious to know what might go wrong.

My latest code makes some minor fixes, and adds the ability to "print" to the macOS clipboard by printing to LPT4. It also shows an error message if it can't find a default printer.

— Reply to this email directly, view it on GitHub https://github.com/joncampbell123/dosbox-x/issues/4669#issuecomment-1865038890, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABI7U5ZGK5N2EO7XZXQN6DTYKM5WDAVCNFSM6AAAAABAQKW7UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRVGAZTQOBZGA. You are receiving this because you were mentioned.

emendelson commented 9 months ago

@ezathashim - That explains it. Presumably, all five jobs will print when you get back to that network, unless you cancel them.

Oddly, there seems to be no macOS command that can test whether a printer is available or not. I've been asking about this for months on various forums and no one can find one. A command existed in OS X about seven or eight years ago, but none exists now. The OS itself knows, because System Settings shows whether the printer is online or not, but the command-line doesn't seem to have a way of knowing this.

EDIT: there seems to be a way to do this, but it requires programming that may be beyond me.

ezathashim commented 9 months ago

I’m trying to make an Intel build on my Intel iMac and I’m getting this error:

The application cannot be opened for an unexpected reason, error=Error Domain=NSOSStatusErrorDomain Code=-10661 "(null)" UserInfo={_LSLine=3863, _LSFunction=_LSOpenStuffCallLocal}

Any ideas why this would happen?

Is there a command that I can use on my M1 MacBook Pro that will generate an Intel DOSBox-X.app?

Thanks

On Dec 20, 2023, at 4:17 PM, emendelson @.***> wrote:

@ezathashim https://github.com/ezathashim - That explains it. Presumably, all five jobs will print when you get back to that network, unless you cancel them.

Oddly, there seems to be no macOS command that can test whether a printer is available or not. I've been asking about this for months on various forums and no one can find one. A command existed in OS X about seven or eight years ago, but none exists now. The OS itself knows, because System Settings shows whether the printer is online or not, but the command-line doesn't seem to have a way of knowing this.

I have an alternative in mind, but it will take some time to put into effect. Thank you for testing this.

— Reply to this email directly, view it on GitHub https://github.com/joncampbell123/dosbox-x/issues/4669#issuecomment-1865150348, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABI7U57OD3EVONOPWYVDDNTYKNIWPAVCNFSM6AAAAABAQKW7UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRVGE2TAMZUHA. You are receiving this because you were mentioned.

emendelson commented 9 months ago

@ezathashim -

I’m trying to make an Intel build on my Intel iMac and I’m getting this error: The application cannot be opened for an unexpected reason, error=Error Domain=NSOSStatusErrorDomain Code=-10661 "(null)" UserInfo={_LSLine=3863, _LSFunction=_LSOpenStuffCallLocal} Any ideas why this would happen?

No.

I just now built it successfully on an Intel machine running Mojave, with ./build-macos and make dosbox-x.app. Try building the current default version of the code (from this repository, not from my fork) and see if you get the same error that you got with my code.

Is there a command that I can use on my M1 MacBook Pro that will generate an Intel DOSBox-X.app? Thanks - Ezat

Theoretically yes, if you have both the Intel version and the ARM version of brew, installed but I don't believe anyone has actually done it.

When a new release of DOSBox-X arrives, I'll put together a universal build of my fork and post it for anyone to use.

ezathashim commented 9 months ago

Ok, I got the fork to compile on Intel. There was a typo in the instructions. The commands are:

./build-macos make dosbox-x.app

If the fork keep the .conf file in the app resources, I guess they will not propagate when a new version is released? Maybe there should be a copy of the .conf file placed in /Preferences or /App Support?

Thanks!

On Dec 21, 2023, at 9:55 PM, emendelson @.***> wrote:

@ezathashim https://github.com/ezathashim -

I’m trying to make an Intel build on my Intel iMac and I’m getting this error: The application cannot be opened for an unexpected reason, error=Error Domain=NSOSStatusErrorDomain Code=-10661 "(null)" UserInfo={_LSLine=3863, _LSFunction=_LSOpenStuffCallLocal} Any ideas why this would happen?

No. I just built it successfully on an Intel machine running Mojave, with ./build-macos and make dosbox-x-app. Try building the current default version of the code (from this repository, not from my fork) and see if you get the same error you got with my code.

Is there a command that I can use on my M1 MacBook Pro that will generate an Intel DOSBox-X.app? Thanks - Ezat Theoretically yes, if you have the Intel version of brew, but I don't believe anyone has actually done it.

When a new release of DOSBox-X arrives, I'll put together a universal build of my fork and post it for anyone to use.

— Reply to this email directly, view it on GitHub https://github.com/joncampbell123/dosbox-x/issues/4669#issuecomment-1867168348, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABI7U57W3EEFC6I4TMVQQ53YKTZB7AVCNFSM6AAAAABAQKW7UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRXGE3DQMZUHA. You are receiving this because you were mentioned.

emendelson commented 9 months ago

@ezathashim

If the fork keep the .conf file in the app resources, I guess they will not propagate when a new version is released? Maybe there should be a copy of the .conf file placed in /Preferences or /App Support? Thanks! - Ezat

If you make changes in your conf file, you can always write a copy of the conf file to any folder. But it might make sense for the app automatically to make a backup copy to ~/Library/Application Support. You could easily add the appropriate command to the [autoexec] section of the conf file. I might add that to the default conf file but rem it out for the user to enable if the user wants it.

Alternatively, you could add a command in [autoexec] that would run commands in a separate conf file in your Library folder. There are endless possibilities.

emendelson commented 9 months ago

@ezathashim - Well, you do provide fascinating challenges. My current code does this:

LPT1 - if the default-printer print queue isn't empty after ten seconds, it pops up a message saying that the job probably didn't print; choose a different printer. If your print jobs require more than ten seconds to complete, let me know, and I'll increase the timeout. I merely guessed at 10 seconds as a reasonable number.

LPT4 - pops up a menu and lets you select a printer; it doesn't know which printer is offline, so it lists all installed printers. I've been trying to figure out a way to fix that for months, and maybe will figure it out someday. LPT4 will need to be entered as a filename in most DOS applications.

LPT8 - Print to LPT8, and the text will go to the macOS clipboard (this was on LPT4 earlier). Again, LPT8 will have to be entered as a filename in most DOS applications.

ezathashim commented 9 months ago

Nice!

I did have an interesting issue that I found at the office. I compiled an Intel version of the app and installed it there. For some reason printing does not work on that computer. The OS is macOS 10.13 (Ventura).

At home I have another Intel running 10.12. I’ll do a test there and get back to you.

Thanks for all your hard (but excellent) work!

On Dec 22, 2023, at 1:23 PM, emendelson @.***> wrote:

@ezathashim https://github.com/ezathashim - Well, you do provide fascinating challenges. My current code does this:

LPT1 - if the default-printer print queue isn't empty after ten seconds, it pops up a message saying that the job probably didn't print; choose a different printer. If your print jobs require more than ten seconds to complete, let me know, and I'll increase the timeout. I merely guessed at 10 seconds as a reasonable number.

LPT4 - pops up a menu and lets you select a printer; it doesn't know which printer is offline, so it lists all installed printers. I've been trying to figure out a way to fix that for months, and maybe will figure it out someday. LPT4 will need to be entered as a filename in most DOS applications.

LPT8 - Print to LPT8, and the text will go to the macOS clipboard (this was on LPT4 earlier). Again, LPT8 will have to be entered as a filename in most DOS applications.

— Reply to this email directly, view it on GitHub https://github.com/joncampbell123/dosbox-x/issues/4669#issuecomment-1867960988, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABI7U57P6SKOBBLDVOM664TYKXFYNAVCNFSM6AAAAABAQKW7UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRXHE3DAOJYHA. You are receiving this because you were mentioned.

emendelson commented 9 months ago

@ezathashim

I did have an interesting issue that I found at the office. I compiled an Intel version of the app and installed it there. For some reason printing does not work on that computer. The OS is macOS 10.13 (Ventura).

My Intel machine is too old to run Ventura, but it runs Mojave and Monterey. I built the current code on the Intel machine in both Mojave and Monterey and it prints perfectly on both.

Have you checked whether you can print from other applications at the office? When the system wouldn't print on your first tests, no other app could have printed either because you were away from your office printer, so it's worth checking whether the problem is in your system, not in my app.

emendelson commented 9 months ago

@ezathashim

I did have an interesting issue that I found at the office. I compiled an Intel version of the app and installed it there. For some reason printing does not work on that computer. The OS is macOS 10.13 (Ventura).

My Intel machine is too old to run Ventura, but it runs Mojave and Monterey. I built the current code on the Intel machine in both Mojave and Monterey and it prints perfectly on both.

Have you checked whether you can print from other applications at the office? When the system wouldn't print on your first tests, no other app could have printed either because you were away from your office printer, so it's worth checking whether the problem is in your system, not in my app.

ezathashim commented 9 months ago

Ok, on my Intel running macOS 12 (Monterey), it works fine. I’ll double-check what app is running at the office on Ventura to make sure it is using the special app.

On Dec 22, 2023, at 2:22 PM, emendelson @.***> wrote:

@ezathashim https://github.com/ezathashim I did have an interesting issue that I found at the office. I compiled an Intel version of the app and installed it there. For some reason printing does not work on that computer. The OS is macOS 10.13 (Ventura).

My Intel machine is too old to run Ventura, but it runs Mojave and Monterey. I built the current code on the Intel machine in both Mojave and Monterey and it prints perfectly on both.

Have you checked whether you can print from other applications at the office? When the system wouldn't print on your first tests, no other app could have printed either because you were away from your office printer, so it's worth checking whether the problem is in your system, not in my app.

— Reply to this email directly, view it on GitHub https://github.com/joncampbell123/dosbox-x/issues/4669#issuecomment-1868008200, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABI7U572U5JB64TCVD75RBTYKXMWZAVCNFSM6AAAAABAQKW7UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRYGAYDQMRQGA. You are receiving this because you were mentioned.

ezathashim commented 9 months ago

Ok, I reinstalled the Intel DOSBox-X app on my Ventura and it works flawlessly. I’m not certain what happened earlier today, but all is good.

My apologies for the false alarm.

Happy Holidays!

On Dec 22, 2023, at 3:08 PM, Ezat Hashim @.***> wrote:

Ok, on my Intel running macOS 12 (Monterey), it works fine. I’ll double-check what app is running at the office on Ventura to make sure it is using the special app.

  • Ezat

On Dec 22, 2023, at 2:22 PM, emendelson @. @.>> wrote:

@ezathashim https://github.com/ezathashim I did have an interesting issue that I found at the office. I compiled an Intel version of the app and installed it there. For some reason printing does not work on that computer. The OS is macOS 10.13 (Ventura).

My Intel machine is too old to run Ventura, but it runs Mojave and Monterey. I built the current code on the Intel machine in both Mojave and Monterey and it prints perfectly on both.

Have you checked whether you can print from other applications at the office? When the system wouldn't print on your first tests, no other app could have printed either because you were away from your office printer, so it's worth checking whether the problem is in your system, not in my app.

— Reply to this email directly, view it on GitHub https://github.com/joncampbell123/dosbox-x/issues/4669#issuecomment-1868008200, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABI7U572U5JB64TCVD75RBTYKXMWZAVCNFSM6AAAAABAQKW7UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRYGAYDQMRQGA. You are receiving this because you were mentioned.

emendelson commented 9 months ago

@ezathashim - And happy holidays to you too!

Meanwhile, I've improved the feature described in an earlier post that warns you if the print job didn't complete:

https://github.com/joncampbell123/dosbox-x/issues/4669#issuecomment-1867960988

This feature now works for both LPT1 and LPT4 (the select-printer feature).

Please try it out and let me know if it either (1) warns you that your printer may be offline when in fact it is on line or (2) fails to warn you when the printer is in fact offline. If either of those things happens, I'll need to change the timeout setting.

ezathashim commented 9 months ago

You’re on a roll!

Sadly, if I print to LPT1, I get this error:

I don't think it is what you intended.

Can you detect this error case in code? If the error can be detected, maybe it should punt the output to Preview when the print job fails.

If you wish, I could always use one of my Apple Developer credits to ask an Apple Engineer on how to determine which printers are available on the network or connected to the computer using a terminal command. It would be best if you could formulate the question, though, since I’m not certain exactly what you need.

Thanks!

On Dec 23, 2023, at 6:28 PM, emendelson @.***> wrote:

@ezathashim https://github.com/ezathashim - And happy holidays to you too!

Meanwhile, I've improved the feature described in an earlier post that warns you if the print job didn't complete:

4669 (comment) https://github.com/joncampbell123/dosbox-x/issues/4669#issuecomment-1867960988

Please try it out and let me know if it either (1) warns you that your printer may be offline when in fact it is on line or (2) fails to warn you when the printer is in fact offline. If either of those things happens, I'll need to change the timeout setting.

— Reply to this email directly, view it on GitHub https://github.com/joncampbell123/dosbox-x/issues/4669#issuecomment-1868388885, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABI7U54IIG6OVPDUVPK3EDDYK5SKPAVCNFSM6AAAAABAQKW7UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRYGM4DQOBYGU. You are receiving this because you were mentioned.