How can I double-click on a file and open it?
Hey, folks!
For a change of pace, I'm creating a media player which can play most video and audio formats (though it relies on external codecs to already be installed.
I want to add the functionality whereby if a user double-clicks on a supported file type from Windows Explorer, my custom media player would open and play it.
I have been able to make associations with particular file types (using the Power Object, and have been able to set up drag-and-drop functionality. But how would I able open a file from Windows Explorer directly?
Note that I am discussing opening a file from Windows Explorer--not MMF2's Developer tool.
Any ideas?...
Thank you very much in advance!
Most appreciatively...
RGBreality
Re: How can I double-click on a file and open it?
You just said you had set up the file associations...and then you contradicted yourself by saying that double-clicking to open the files doesn't work? How did you set up the file associations?
EDIT: Er, I misunderstood, see Jacob's post and my post below.
Re: How can I double-click on a file and open it?
You will have to retrieve the command line to get the path of the file you opened with, and load that into your video or sound player.
Re: How can I double-click on a file and open it?
Don't forget that you can open multiple files in one program, and thus must check for that.
Re: How can I double-click on a file and open it?
Hey, folks! Thank you for the replies.
How do I access the command line to retrieve the path to selected files?
EDIT: I'm also stumped as to what the conditions for such an event would be. I'm not sure how to specify "when files outside of MMF2 are clicked."
Thank you again for your assistance! I really appreciate it!
RGBreality
Re: How can I double-click on a file and open it?
Use the Power System Object to get your app to open by default. That will only open it though, you'll also need to load the file when it opens.
The file that opened your program will be contained in the commandline; use the CommandLine$ expression to retrieve it. You'll need to manipulate it some to extract the filename from the other symbols it puts in, and it may be different for different ways you open the program (dragging the file onto the EXE vs. opening it from the file).
Re: How can I double-click on a file and open it?
Here is a quick example of how to get the files that were opened with your program.
http://mfa.aquadasoft.com/view/1308690494-ParseCommandLine
Just select a load of files and drag them onto the built EXE and watch it come up with the list.
Parsing the command line is tricky, as windows gives you some file paths with "" around them (if there are spaces in the URL), and it gives you some file paths without "" around them (if there are no spaces in them). Therefore this was a pretty tricky example to make!
Re: How can I double-click on a file and open it?
Hey, LB! Thank you very much for putting together this example file for me!
I am having a problem accessing it, though, as I don't have the "Internal object" object installed (nor can I find it on the FusionWiki Extension List). How can I get this extension?
Thank you again for all your help!
Most appreciatively...
RGBreality
Re: How can I double-click on a file and open it?
Quote:
Originally Posted by RGBreality
I don't have the "Internal object" object
It's not good to paraphrase things; it's called the Internal List Object.
Re: How can I double-click on a file and open it?
Nifflas (I believe) made a widget that does this too :)