Launching an external mac program

Archives Forums/MacOS X Discussion/Launching an external mac program

EOF(Posted 2006) [#1]
Mac users,

Can you guys help with regards to launching an external program via BlitzMax on a Mac?

Using the test code below ...

a) Does a launched program run correctly?

Example: Try launching the BlitzMax IDE and monitoring the status bar of the laucher program.

b) Does the lauched program close immediately afterwards by itself?

c) can you terminate the launched program from the launchers GUI [Terminate application] button?




WendellM(Posted 2006) [#2]
Doesn't seem to work properly on my 10.3.9 G4 (I get "b." as described above). Pressing "Run application" brings up the file requester, and when I select an app, your program's window says "<name>.app running" at the bottom. But the program doesn't appear, and after a second or two the window message changes to "App terminated." I tried it with Firefox, Calculator, and Chess, starting all three from the Applications folder, as well as trying to run a shortcut to MaxIDE on the desktop (using a standalone, compiled version of your launcher) - the same result for all.

Just to check, I tried your launcher in Win XP and Win 98, and it ran fine (could run/terminate apps through the window). In Ubuntu 5.10 Linux I could run apps, but not terminate them through the window (they terminated OK manually).


EOF(Posted 2006) [#3]
Thanks for the in-depth help WendelM.
Do all mac executables end with a '.app' extension?


WendellM(Posted 2006) [#4]
Glad to help - thank you for the life-saving Framework Assistant. :)

OS X does the goofy extension-hiding that XP does by default. Going into Finder/Preferences/Advanced and turning on "show all extensions" is supposed to make them all show up, but it doesn't for me - only some show .app. But doing a Get Info shows that the ones I checked do have ".app" and doing a search for "app" shows that what seems like all apps have it. So, that's a qualified "yes, they all seem to."


EOF(Posted 2006) [#5]
WendellM,

Can you try this modification to the above test code and let me know if it correctly filters out everything except Mac applications? ..
' cross-platform executable extension filter
?Win32
Const ext$="Executable:exe"
?Linux
Const ext$=""
?Mac
Const ext$="Application:app"
?



WendellM(Posted 2006) [#6]
Yes, it works - though the switch needs to be "?MacOS" rather than "?Mac". Only .app files can be selected (everything else shows up grayed-out), and all the apps seem to show up whether Finder shows the .app extension or not. They still immediately quit if run (as expected, since no code has changed in that regard).

In playing with this, I found out that Mac file requesters don't have the combobox that Windows does for switching among filetypes. So, the current RequestFile example in the help, which allows you to switch among Image Files, Text Files, and All Files in Windows, doesn't allow that in OS X. (That should present no problems for your launcher, since there's presumably no need to allow anything other than .app files to launch - except that shortcuts to applications don't work since they have no extensions).

However, on the Mac all possible extensions in the supplied filter string seem combined into a single list automatically. So, in the RequestFile example, the filter of "Image Files:png,jpg,bmp;Text Files:txt;All Files:*" always shows png, jpg, bmp, and txt files (whereas they're in separate groups in Windows). But, I don't see a way to allow all files to be selected in OS X when such a filter string is used. Files with extensions not in the filter list show up grayed-out in OS X, and they cannot be selected (while they only appear in Win if "All Files" is selected):

Windows XP:


Mac OS X:



I'm submitting this as a bug report.