one instance only to accept file

My application can be started when a user double-clicks on a file name in finder or windows explorer with a give extension.
If xojo is running, a second instance will be opened. How can I avoid this and make sure the running instance will handle the newly clicked file?

Thanks for your help

Use a Mutex to detect whether an instance is running. Then communicate with the instance via IPCSocket and pass it the file path to open.

When the first instance opens, it creates a mutex and listens on a socket.
When the second instance opens, it tries to create the mutex, fails, connects to the socket and writes the file path.

Thanks Tim,
I’ll try it again, not sure I find my way through the IPCSocket thing. Is this listening at all times and if so, does it slow down the program?
john m.

[quote=119317:@John Miescher]Thanks Tim,
I’ll try it again, not sure I find my way through the IPCSocket thing. Is this listening at all times and if so, does it slow down the program?[/quote]

See /Xojo 2014 Release 2.1/Example Projects/Communication/IPCSocket.xojo_binary_project

by George I think she’s got it. haleluja and many thanks for your prompt help.