Comments

1 comment

  • Avatar
    Jake

    In the article associating file extensions you can learn how to create file associations on Windows. The example below shows how to allow the user to select which specific file extensions to choose:

    <project>
      <fullName>Demo Project</fullName>
      <shortName>demo</shortName>
      <version>1.0</version>
      <parameterList>
        <directoryParameter>
          <ask>yes</ask>
          <cliOptionName>prefix</cliOptionName>
          <default>${platform_install_prefix}/${product_shortname}-${product_version}</default>
          <description>Installer.Parameter.installdir.description</description>
          <explanation>Installer.Parameter.installdir.explanation</explanation>
          <mustBeWritable>yes</mustBeWritable>
          <mustExist>0</mustExist>
          <name>installdir</name>
          <value>${platform_install_prefix}/${product_shortname}-${product_version}</value>
        </directoryParameter>
        <parameterGroup>
          <name>group</name>
          <title>Select</title>
          <explanation>Please select the extensions you want to register</explanation>
          <parameterList>
            <booleanParameter name="mp3" description=".mp3" displayStyle="checkbox-left" />
            <booleanParameter name="wav" description=".wav" displayStyle="checkbox-left" />
          </parameterList>
        </parameterGroup>    
      </parameterList>
      <postInstallationActionList>
        <associateWindowsFileExtension>
          <extensions>.mp3</extensions>
          <progID>mycompany.package</progID>
          <icon>${installdir}\images\myicon.ico</icon>
          <mimeType>music/mp3</mimeType>
          <commandList>
            <command>
              <verb>open</verb>
              <runProgram>${installdir}\yourprogram.exe</runProgram>
              <runProgramArguments>"%1"</runProgramArguments>
            </command>
          </commandList>
          <ruleList>
            <isTrue value="${mp3}" />
          </ruleList>
        </associateWindowsFileExtension>
        <associateWindowsFileExtension>
          <extensions>.wav</extensions>
          <progID>mycompany.package</progID>
          <icon>${installdir}\images\myicon.ico</icon>
          <mimeType>music/wav</mimeType>
          <commandList>
            <command>
              <verb>open</verb>
              <runProgram>${installdir}\yourprogram.exe</runProgram>
              <runProgramArguments>"%1"</runProgramArguments>
            </command>
          </commandList>
          <ruleList>
            <isTrue value="${wav}" />
          </ruleList>
        </associateWindowsFileExtension>
      </postInstallationActionList>    
    </project>

    0
    Comment actions Permalink

Please sign in to leave a comment.