Createprocess not working the same under MacOS

BlitzMax Forums/BlitzMax Beginners Area/Createprocess not working the same under MacOS

Pierrou(Posted 2011) [#1]
Hello,

I'm still working on a piece of software meant to load text files, modify them, and then save them as text files again.

In order to edit or print the texts, I want to open an external app, for example the Windows Notepad, after saving the text.

Under windows it goes like this :

createprocess (cheminbloc$+" "+asauver$)

where cheminbloc$ is an user-defined path, leading to the notepad, MSWord or any text other text editor,
and asauver$ is the path of the file that has just been saved.

And it works fine.

Under MacOS, cheminbloc$ is "/Applications/TextEdit.app", and createprocess doesn't do anything. It's not a big issue but I'd really love to get both versions to work the same (and to understand what's happening).

Thanks in advance for your help,


ima747(Posted 2011) [#2]
a .app is actually a folder, you will need to get the path to the binary for the app located in *.app/Contents/MacOS/<binary here named similarly to the app>. The true binary name can be found in the Info.plist in the Contents folder in the app.

Alternatively you might want to look into using a command line function like "open" instead, rather than parsing out the Info.plist to get the binary name...


Pierrou(Posted 2011) [#3]
Using *.app/Contents/MacOS/<binary works! I should have tried that before posting my question...

I think I was just wondering what would happen if one would choose an universal app as text editor; I don't even know whether such a thing is likely to happen or not...

Thanks a lot ima747!!


Pierrou(Posted 2012) [#4]
Hi again,

I'm still working on that game (don't have much time for it but it's almost done now). For some reason (which mainly has to do with laziness) the help window is an external executable which you can call by pressing a key. For some other reason I would need that window to remain opened even if the user closed the main program window (so using createprocess won't work will it?). So I'm using OpenURL to launch that help window exe. On windows, it's fine, as usual, but on MacOS, the app launches along with a console, which looks quite bad......? Is there a way to hide that console or something?

Thanks in advance!


Pierrou(Posted 2012) [#5]
Hi again,

I should have searched the forums a little bit further before asking: the answer had already been given somewhere else before...

That command : system_("open application.app") seems to be doing what I want...

Thanks to everyone here for keeping these forums alive, I'm still learning a little bit more about Blitz every day...