Open app by double clicking on associated file type

Example: When I click on an word document, Word opens and displays the file.
How is this achieved using Xojo?

  1. I simply need to set the file association for Windows and Mac. (I know I can do that with Windows using Inno Installer).
  2. Then clicking the associated file needs to pass the file path to the program (as in my vb6 apps). I can take it from there.

Add an Open event in App.
Use the FolderItem arg to load the file. Case of multiple cliked files: you have to loop into the OS passed FolderItem(s).

You will find what you need in the documentation (the only question is in how many times you will find it).

I searched for more than five minutes, but I do not found the related example(s) / documentation.

Edit:

Have-you read these:
http://docs.xojo.com/UserGuide:File_Type_Set_Editor
http://docs.xojo.com/UserGuide:File_Type_Sets

Thanks Emile, do you know of an example of the code for this?
Is it anything to do with System.commandline?

Nothing.

I already told you: I searched in the LR and not found. You may be luckier than me.

Tell more on what you’ve done and I will give you what is missing comparing to a project here.

Have you read this page:

http://docs.xojo.com/Application.OpenDocument_event

?

If your app has a file/open menu item, you will display a file browser, then you will open the file.
Usually by passing the folderitem into some ‘openmydocument’ method

In the app OpenDocument event, you will be passed a folderitem object already populated.
You should check the file extension is one that you support, then pass it into the usual handler

[quote=431496:@Emile Schwarz]Have you read this page:

http://docs.xojo.com/Application.OpenDocument_event [/quote]
Thankyou, this is what I’m after.
Thankyou too Jeff. I already have a filetype set for my file/open menu item so it was simple to add more info to it for Mac to associate the file type with the program and also add an Inno setup script for Windows to modify the registry. Since only one file extension will be used I don’t think I need to validate if it opens the application. I can’t find any info for Linux yet.

[quote=431513:@Craig Grech]Thankyou, this is what I’m after.
Thankyou too Jeff. I already have a filetype set for my file/open menu item so it was simple to add more info to it for Mac to associate the file type with the program and also add an Inno setup script for Windows to modify the registry. Since only one file extension will be used I don’t think I need to validate the file extension if it is the only type that launches the app.
I can’t find any info for Linux yet.[/quote]

Unless someone (for example) manually changes the association of PDFs to open with your app…

Fair point, thanks.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.