Can't open two blitzmax apps at the same time

Archives Forums/MacOS X Discussion/Can't open two blitzmax apps at the same time

ozak(Posted 2006) [#1]
Hi.

I'm currently doing some network testing, and I can't open the same app twice. It just selects the already open app instead of launching a second copy.

Works fine on Windows.

Anyone? ;)

Thanks in advance


WendellM(Posted 2006) [#2]
Not a solution, but a workaround: compile second copy with a different name?


Winni(Posted 2006) [#3]
Looks as if this behaviour is hard-wired into BlitzMax on OS X - you just canīt spawn a second application instance. Maybe you should file a feature request?


Brucey(Posted 2006) [#4]
You might like to try the following.

Open a terminal and type (based on your app location and name) :
/Path/To/Application.app/Contents/MacOS/Application &

The ampersand (&) at the end tells OSX to detach the process from your session.
You should then be able to run the same command again, spawning another copy of your app.


Tricky(Posted 2006) [#5]
As far as I know MacOS X itself cannot open the same application twice. Not in normal use, at least (Except for X11 apps and Java apps). That has nothing to do with BlitzMax, that's just an OS X issue.

Most OS X apps are written that way that they do multiple sessions by itself, instead of needlessly filling the memory with the same program twice, like Windows does.

I must say that I never tried Brucey's method. I must say that I already have bad experiences by opening an app, but directly accessing the UNIX exe file, instead of just opening the app bundle. Then I didn't use the "&" trick already.


remz(Posted 2006) [#6]
I had exactly the same issue when testing my own networked blitz game.
The only I managed it was to copy my app to a different folder. There, you could launch it, and launch another one straight from Blitz IDE.

Please note that copying an app and renaming it will not work. For a work-around this problematic behavior, read this related thread:
http://blitzbasic.com/Community/posts.php?topic=59717

This discussion brings me to a similar question:
I'm writing an image viewer in BlitzMax. When I double-click on a JPG in Finder, it opens my app correctly (using AppArgs[]). but if my app is already running and I switch back to Finder and double-click on another image, I would like my application to handle the event and know which file was selected. Is there a way? It's like receiving a new AppArgs while running.


remz(Posted 2006) [#7]
..
I should have spent 20 additionnal seconds in the blitz documentation.
Here's a code snippet that shows how to handle 'open file' request and file drag'n dropped into the dock-icon of your blitz app:

Repeat
	Local event = PollEvent()
	If(event = 0) Then Exit
	If(event = EVENT_APPOPENFILE) Then 
		Print "Open file request="+EventText()
	EndIf
Forever