Create new file extensions and make file associations
The following article uses options that are available starting with the Professional edition and project type.
File association in Windows refers to the mapping of file types to the applications that are used to open them. When you double-click on a file in Windows Explorer or any other file manager, Windows checks the file's extension (e.g., .txt, .docx, .jpg) to determine which application to use to open it. This association allows Windows to automatically launch the appropriate application when you interact with a file.
For example, if you double-click on a file with the ".txt" extension, Windows will typically open it with Notepad by default because Notepad is the default application associated with .txt files.
File associations can be customized by users to specify which application should be used to open a particular file type. This can be done through the "Open with" menu in Windows Explorer, where users can choose a specific application to open a file, or by changing the default program associated with a file type in the Control Panel or Settings app.
If multiple applications on your system are capable of handling a specific file association, Windows will prompt you to choose which application to use for managing that particular file type. However, on modern versions of Windows, setting the default application for a specific file extension is a user-controlled process. Unlike in older versions, programmatically changing default app settings for file types is no longer permitted. This ensures that users have full control over their file management preferences and can make personalized choices regarding which applications handle their files by default.
1. Create project
After launching Advanced Installer, you will be presented with a dialog where you can choose the type of the project you want to create.
Select Professional and press the Create Project button. The new project has been created and from now on you will edit it.
Save the project and give it an appropriate name - let's say "File Association
Sample" for this example.
2. Enter product details
Now you can see the main view split into two panes. In the left pane, you can see all the options you have to edit in your current project, grouped in categories.
Switch to “Product
Details” page to set the information seen by the user for your installation
package. Fill the fields in the right pane with the corresponding data.
The information from this view will be displayed in the Control Panel.
3. Add files and folders to your project
The next step is to add to the project the files and/or folders that compose your application.
Select “Files and Folders” from the
“Resources” menu on the left pane.
Click on the toolbar button and select the files
of your application, or use the drag-and-drop to add resources from
the disk to the project.
Once you’ve added the files of your application in the Files and Folders view, we can create the file association.
4. Defining File Association
In the File Association you can create the file extension and make the file association.
Your application uses files with a particular extension (in our example that is "ai-txt" & "ai-txtex" ). You may want to associate that type of files to be opened or edited with your application. Advanced Installer helps you do this in a very simple way.
Choose “File Association” in the left
pane.
Use the toolbar button to create a new
extension: "ai-txt". Enter a description of this extension in the appropriate field in the
right-side pane. You may choose an icon to be displayed for all the files with the extension
you created.
For every extension contained in your application, you need to add at least one verb. The name of the verb will be seen in the context menu that appears when you right-click on a file of "ai-txt" type in Windows Explorer.
In this example, you should leave the defaults settings. The effect is that when you double click a file or you choose the "Open" action from a context menu of an "ai-txt" file, the application is automatically launched with the command line argument specifying the absolute path of the chosen file.
5. Build and install
If you build and install the resulted setup package, you should notice the files with configured extension are automatically associated with the application.