Opening doubleclicked stack files with custom extensions

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
tomBTG
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 72
Joined: Fri Nov 25, 2011 6:42 pm
Location: Kansas City

Opening doubleclicked stack files with custom extensions

Post by tomBTG » Thu Jul 23, 2015 11:03 pm

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5147
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Opening doubleclicked stack files with custom extensions

Post by Mark » Fri Jul 24, 2015 12:39 pm

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

tomBTG
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 72
Joined: Fri Nov 25, 2011 6:42 pm
Location: Kansas City

Re: Opening doubleclicked stack files with custom extensions

Post by tomBTG » Fri Jul 24, 2015 3:39 pm

Thanks for the guidance on that, Mark!
Tom

Post Reply

Return to “Windows”