Discussion:
associations between files and app
Jean-Luc Arnaud
2017-03-21 17:01:29 UTC
Permalink
Hi all,

I would like to associate a specific file type with my app, on Mac and Win.

I create my own filetype with a specific extension.

On Mac, I defined the file types in the OS X Build settings options.

But for Windows, the same option does not exist and I guess I will have
to create key(s) in the Register.

My question is: what key(s) should I create in order to define a file
association?

I have MBS plugins, in of any interest in this case.

Thanks a lot for your help.
--
Jean-Luc Arnaud


_______________________________________________

Xojo forum:

https://forum.xojo.com/
vaughnsc .
2017-03-21 17:07:32 UTC
Permalink
Plugin not required, you can set up the Registry on first run in your app
or in its installer if it has one.

I don't have the requisite entries in my head, but the subject was broached
about a month ago on this very list.

If no one chimes in, I'll go dig up one of my projects and paste a sample
regedit file so you can see what your result should look like.

Vaughn
Post by Jean-Luc Arnaud
Hi all,
I would like to associate a specific file type with my app, on Mac and Win.
I create my own filetype with a specific extension.
On Mac, I defined the file types in the OS X Build settings options.
But for Windows, the same option does not exist and I guess I will have to
create key(s) in the Register.
My question is: what key(s) should I create in order to define a file
association?
I have MBS plugins, in of any interest in this case.
Thanks a lot for your help.
--
Jean-Luc Arnaud
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

https://forum.xojo.com/
V S Cordero
2017-03-21 17:15:50 UTC
Permalink
Here is my write-up from last year, I used a REGEDIT file and Advance installer, but its well-commented on the requirements, so you can implement whichever way you prefer.

HTH

Vaughn
Post by Jean-Luc Arnaud
Hi all
It seems that many Xojo developers use InnoSetup for creating Windows installers.
I prefer Advanced Installer because it can create MSI packages.
One limitation I just ran into is the disabling of a ‘File Association’ wizard in the Free version.
Necessity being the mother of invention (and sleepless nights) I believe I have sorted it out manually, and also a way to mostly ‘script’ it in AI, which (currently at 12.5) accepts REGEDIT files. I am attaching a generic example in the hopes it will be useful. Tested in Windows 8.
One last-minute observation is that Xojo (at least my version) doesn’t embed the document icons from FileTypes into Windows builds; you’ll have to provide them separately. In my case, I copied a prepared .ICO file to the build’s Resources folder using Build Automation.
Cheers,
Vaughn
What follows the dashed line can be saved as a plain-text .reg file and edited or just follow my comments for the Registry changes in your AI installer.
---------
REGEDIT4
; Unique Identifier (UID)
; Create one or more UIDs for each document type
; Several file extensions may share a UID
; Set a human-friendly description as its (default) value
; BEST PRACTICE: Use reverse domain notation for UID
; RECOMMENDED: Manually set 'delete on uninstall' property on this first key (can’t be scripted)
[HKEY_CLASSES_ROOT\com.mydomain.myapp]
@="MyApp Document"
; Shell Command
; Add a shell command that can open the file, the two args must be quoted AND escaped
; ADVANCED INSTALLER: you should change this to [APPDIR]path\to\MyApp.exe after import
[HKEY_CLASSES_ROOT\com.mydomain.myapp\shell\open\command]
@=“\"path\to\MyApp.exe\" \"%1\""
; File Icons
; Optionally, declare a path to an icon resource (exe, dll, ico files)
; Append the icon's zero-based index within the file, as shown
[HKEY_CLASSES_ROOT\com.mydomain.myapp\DefaultIcon]
@="path\to\mydocumenticons.ico,0"
; File Extensions
; Associate one or more file extensions to a UID defined above
; In this example, multiple extensions share a common UID
[HKEY_CLASSES_ROOT\.myAppDoc1]
@="com.mydomain.myapp"
[HKEY_CLASSES_ROOT\.myAppDoc2]
@="com.mydomain.myapp"
_______________________________________________

Xojo forum:

https://foru
Jean-Luc Arnaud
2017-03-21 17:25:03 UTC
Permalink
Many thanks Vaughn.

Seems clear, I will try this.

Jean-Luc Arnaud
Post by V S Cordero
Here is my write-up from last year, I used a REGEDIT file and Advance installer, but its well-commented on the requirements, so you can implement whichever way you prefer.
HTH
Vaughn
Post by Jean-Luc Arnaud
Hi all
It seems that many Xojo developers use InnoSetup for creating Windows installers.
I prefer Advanced Installer because it can create MSI packages.
One limitation I just ran into is the disabling of a ‘File Association’ wizard in the Free version.
Necessity being the mother of invention (and sleepless nights) I believe I have sorted it out manually, and also a way to mostly ‘script’ it in AI, which (currently at 12.5) accepts REGEDIT files. I am attaching a generic example in the hopes it will be useful. Tested in Windows 8.
One last-minute observation is that Xojo (at least my version) doesn’t embed the document icons from FileTypes into Windows builds; you’ll have to provide them separately. In my case, I copied a prepared .ICO file to the build’s Resources folder using Build Automation.
Cheers,
Vaughn
What follows the dashed line can be saved as a plain-text .reg file and edited or just follow my comments for the Registry changes in your AI installer.
---------
REGEDIT4
; Unique Identifier (UID)
; Create one or more UIDs for each document type
; Several file extensions may share a UID
; Set a human-friendly description as its (default) value
; BEST PRACTICE: Use reverse domain notation for UID
; RECOMMENDED: Manually set 'delete on uninstall' property on this first key (can’t be scripted)
[HKEY_CLASSES_ROOT\com.mydomain.myapp]
@="MyApp Document"
; Shell Command
; Add a shell command that can open the file, the two args must be quoted AND escaped
; ADVANCED INSTALLER: you should change this to [APPDIR]path\to\MyApp.exe after import
[HKEY_CLASSES_ROOT\com.mydomain.myapp\shell\open\command]
@=“\"path\to\MyApp.exe\" \"%1\""
; File Icons
; Optionally, declare a path to an icon resource (exe, dll, ico files)
; Append the icon's zero-based index within the file, as shown
[HKEY_CLASSES_ROOT\com.mydomain.myapp\DefaultIcon]
@="path\to\mydocumenticons.ico,0"
; File Extensions
; Associate one or more file extensions to a UID defined above
; In this example, multiple extensions share a common UID
[HKEY_CLASSES_ROOT\.myAppDoc1]
@="com.mydomain.myapp"
[HKEY_CLASSES_ROOT\.myAppDoc2]
@="com.mydomain.myapp"
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

https://forum.xojo.com/
V S Cordero
2017-03-21 17:38:11 UTC
Permalink
Nitpicking on my own example:

Probably the only thing I’d clarify (it may be contextually obvious but, for the sake of someone else running across this in the future):

The ‘@’ in the REGEDIT file format means (default): in other words, the entry has NO key/name. On re-reading I didn’t make this clear in my comments.

Vaughn
Post by Jean-Luc Arnaud
Many thanks Vaughn.
Seems clear, I will try this.
Jean-Luc Arnaud
Post by V S Cordero
Here is my write-up from last year, I used a REGEDIT file and Advance installer, but its well-commented on the requirements, so you can implement whichever way you prefer.
HTH
Vaughn
Post by Jean-Luc Arnaud
Hi all
It seems that many Xojo developers use InnoSetup for creating Windows installers.
I prefer Advanced Installer because it can create MSI packages.
One limitation I just ran into is the disabling of a ‘File Association’ wizard in the Free version.
Necessity being the mother of invention (and sleepless nights) I believe I have sorted it out manually, and also a way to mostly ‘script’ it in AI, which (currently at 12.5) accepts REGEDIT files. I am attaching a generic example in the hopes it will be useful. Tested in Windows 8.
One last-minute observation is that Xojo (at least my version) doesn’t embed the document icons from FileTypes into Windows builds; you’ll have to provide them separately. In my case, I copied a prepared .ICO file to the build’s Resources folder using Build Automation.
Cheers,
Vaughn
What follows the dashed line can be saved as a plain-text .reg file and edited or just follow my comments for the Registry changes in your AI installer.
---------
REGEDIT4
; Unique Identifier (UID)
; Create one or more UIDs for each document type
; Several file extensions may share a UID
; Set a human-friendly description as its (default) value
; BEST PRACTICE: Use reverse domain notation for UID
; RECOMMENDED: Manually set 'delete on uninstall' property on this first key (can’t be scripted)
[HKEY_CLASSES_ROOT\com.mydomain.myapp]
@="MyApp Document"
; Shell Command
; Add a shell command that can open the file, the two args must be quoted AND escaped
; ADVANCED INSTALLER: you should change this to [APPDIR]path\to\MyApp.exe after import
[HKEY_CLASSES_ROOT\com.mydomain.myapp\shell\open\command]
@=“\"path\to\MyApp.exe\" \"%1\""
; File Icons
; Optionally, declare a path to an icon resource (exe, dll, ico files)
; Append the icon's zero-based index within the file, as shown
[HKEY_CLASSES_ROOT\com.mydomain.myapp\DefaultIcon]
@="path\to\mydocumenticons.ico,0"
; File Extensions
; Associate one or more file extensions to a UID defined above
; In this example, multiple extensions share a common UID
[HKEY_CLASSES_ROOT\.myAppDoc1]
@="com.mydomain.myapp"
[HKEY_CLASSES_ROOT\.myAppDoc2]
@="com.mydomain.myapp"
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

https://forum.xojo

Jean-Luc Arnaud
2017-03-21 17:23:20 UTC
Permalink
Thanks Vaughn.

I will search for this thread.
Post by vaughnsc .
If no one chimes in, I'll go dig up one of my projects and paste a sample
regedit file so you can see what your result should look like.
With pleasure!


Jean-Luc Arnaud
Post by vaughnsc .
Plugin not required, you can set up the Registry on first run in your app
or in its installer if it has one.
I don't have the requisite entries in my head, but the subject was broached
about a month ago on this very list.
If no one chimes in, I'll go dig up one of my projects and paste a sample
regedit file so you can see what your result should look like.
Vaughn
Post by Jean-Luc Arnaud
Hi all,
I would like to associate a specific file type with my app, on Mac and Win.
I create my own filetype with a specific extension.
On Mac, I defined the file types in the OS X Build settings options.
But for Windows, the same option does not exist and I guess I will have to
create key(s) in the Register.
My question is: what key(s) should I create in order to define a file
association?
I have MBS plugins, in of any interest in this case.
Thanks a lot for your help.
--
Jean-Luc Arnaud
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

https://forum.xojo.com/
Loading...