Page 1 of 1

Opening doubleclicked stack files with custom extensions

Posted: Thu Jul 23, 2015 11:03 pm
by tomBTG
Hi, Livecoders.

In my standalone app on Windows, I use a custom extension on stack files to save user work. Doubleclicking any of those files will launch my app and load the chosen file. However, once the app is running, doubleclicking another file does not update the command line arguments. ($1 continues to have the path to the file that opened the app, and there does not appear to be an additional $#s created.) In other words, it seems to only work when the app is being launched. (The app is set not to allow multiple instances.)

To attempt to detect additional file open attempts, I use the logic that the user must leave the app to doubleclick a file, therefore I use an

Code: Select all

on Resume
handler on the card to recheck the command line arguments. But the data in the $ globals only contains the original file info.

Is there another way to detect when a file is doubleclicked once an app is running?

Thanks,
Tom Bodine

Re: Opening doubleclicked stack files with custom extensions

Posted: Fri Jul 24, 2015 12:39 pm
by Mark
Hi Tom,

The command line arguments will always be the same. They are set by the operating system when the file is opened. This is not affected by LiveCode. Therefore, I don't understand why you would expect different command line arguments once the file has been opened.

The relaunch message will do what you need. Read about this message in the dictionary. You can choose if you want to start a new instance or resume the current instance of the app. If you choose to resume the current instance, the command line arguments are passed on the the current instance of the app.

The relaunch message can be a little tricky and confusing. If you don't get to work, just come back here and ask.

Kind regards,

Mark

Re: Opening doubleclicked stack files with custom extensions

Posted: Fri Jul 24, 2015 3:39 pm
by tomBTG
Thanks for the guidance on that, Mark!
Tom