File Association: how do I get the filename passed to my App

Got a problem you cannot solve? Try here.
JohnO
Posts: 127
Joined: Tue Jun 18, 2013 9:52 am

File Association: how do I get the filename passed to my App

Postby JohnO » Mon Jul 29, 2013 1:36 pm

Hello
As best I can tell from the running app, the name of the file selected in Explorer and which opened my application, was not passed into it. I went back to my File Associtations definition in the Project tab, and edited my entry. I selected the Shell Verbs tab to see what it offered, and I think this is where I need to define something so that the name of the selected file will get passed to my app, as though it had been typed into a command line invocation (e.g myapp.exe c:\filename.xyz).

I have added 'Open' as the verb, but I have no idea how to define the parameter so that it becomes the name of the selected file. The F1 help, doesn't really, as all it says is "Enter the command line parameters to be passed to the application associated with this file type for the current verb." The required parameter is not fixed. I was hoping Help would tell me how to indicate that the selected file name would be passed.

Regards, John

JohnO
Posts: 127
Joined: Tue Jun 18, 2013 9:52 am

Re: File Association: how do I get the filename passed to my

Postby JohnO » Tue Jul 30, 2013 6:12 am

I have discovered the answer. I created a new, temporary installer using Quick Start. completed the file association info, and then looked at what had been created.

On the Shell Verbs tab of the File Association definition, the parameter for 'Open' is

Code: Select all

"%1"
.

It would be really helpful, if the F1 Help could show this as it's what most people would want. Also, what other parameters could be used here?

What is not obvious, is whether I need to add something extra or different, to open multiple files?

{Edit: Selecting two files resulted in opening two copies of the application (which is not allowed). I tried adding "%2" "%3" to the parameters, but that made no difference. So, I do need to know how to define selecting multiple files.]

John

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: File Association: how do I get the filename passed to my

Postby FrancescoT » Tue Jul 30, 2013 9:03 am

Dear John,

First of all I'm happy that you have partially solved your problem.

Regarding the documentation with Verb parameters, you should refer to the available Microsoft developer's guide about the argument.
The possibility to use certain parameters, it is strictly related on how the application was developed and if it supports DDE commands.

I am sure that you can easily understand that it would be impossible to integrate such huge amount of information with the IA documentation.

More info about the argument can be found at the following link;
http://msdn.microsoft.com/en-us/library/windows/desktop/cc144175(v=vs.85).aspx

Finally regarding your question about how to pass Shell Verbs to open multiple files, as I said before, this depends on how you have developed your application and/or, if you have integrated DDE with it.

For example with DDE, when the Shell needs to execute the verb for each selected item, it will automatically start your executable only if it is not already running and then pass each item to your single instance using the DDE command that you specified.

Hope this helps you.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

JohnO
Posts: 127
Joined: Tue Jun 18, 2013 9:52 am

Re: File Association: how do I get the filename passed to my

Postby JohnO » Wed Jul 31, 2013 4:14 am

Thanks Francesco
Our application is written Java, in fact it is based on the Eclipse framework. So, nothing as clever as DDE is used. I have written code to expect a list of names of any length at start-up. (This is a new feature, because we were not able to associate our file extension with our app before).

I have just tested from a command line with two file names:
ourapp.exe "file one.xyz" "file two.xyz"
The app opens with each file opened in its own tab.

This is want I would like to achieve with files selected in the file Explorer, if at all possible.

I've tried using "%1" %%2" in the parameters, but clearly the mechanism for selecting from Explorer doesn't interpret a multiple-selection as 'these files to one instance of the associated program', in the way that opening text files in a tabbed editor (like Notepad++) works.

If we can only manage one file from Explorer, that's progress, but it would be nice to get multiple files opening in one instance of our app.

Regards, John


Return to “Technical Support”

Who is online

Users browsing this forum: Google [Bot] and 149 guests