-; fileassoc.nsh\r
-; File association helper macros\r
-; Written by Saivert\r
-;\r
-; Features automatic backup system and UPDATEFILEASSOC macro for\r
-; shell change notification.\r
-;\r
-; |> How to use <|\r
-; To associate a file with an application so you can double-click it in explorer, use\r
-; the APP_ASSOCIATE macro like this:\r
-;\r
-; Example:\r
-; !insertmacro APP_ASSOCIATE "txt" "myapp.textfile" "$INSTDIR\myapp.exe,0" \\r
-; "Open with myapp" "$INSTDIR\myapp.exe $\"%1$\""\r
-;\r
-; Never insert the APP_ASSOCIATE macro multiple times, it is only ment\r
-; to associate an application with a single file and using the\r
-; the "open" verb as default. To add more verbs (actions) to a file\r
-; use the APP_ASSOCIATE_ADDVERB macro.\r
-;\r
-; Example:\r
-; !insertmacro APP_ASSOCIATE_ADDVERB "myapp.textfile" "edit" "Edit with myapp" \\r
-; "$INSTDIR\myapp.exe /edit $\"%1$\""\r
-;\r
-; To have access to more options when registering the file association use the\r
-; APP_ASSOCIATE_EX macro. Here you can specify the verb and what verb is to be the\r
-; standard action (default verb).\r
-;\r
-; And finally: To remove the association from the registry use the APP_UNASSOCIATE\r
-; macro. Here is another example just to wrap it up:\r
-; !insertmacro APP_UNASSOCIATE "txt" "myapp.textfile"\r
-;\r
-; |> Note <|\r
-; When defining your file class string always use the short form of your application title\r
-; then a period (dot) and the type of file. This keeps the file class sort of unique.\r
-; Examples:\r
-; Winamp.Playlist\r
-; NSIS.Script\r
-; Photoshop.JPEGFile\r
-;\r
-; |> Tech info <|\r
-; The registry key layout for a file association is:\r
-; HKEY_CLASSES_ROOT\r
-; <applicationID> = <"description">\r
-; shell\r
-; <verb> = <"menu-item text">\r
-; command = <"command string">\r
-;\r
- \r
-!macro APP_ASSOCIATE EXT FILECLASS DESCRIPTION ICON COMMANDTEXT COMMAND\r
- ; Backup the previously associated file class\r
- ReadRegStr $R0 HKCR ".${EXT}" ""\r
- WriteRegStr HKCR ".${EXT}" "${FILECLASS}_backup" "$R0"\r
- \r
- WriteRegStr HKCR ".${EXT}" "" "${FILECLASS}"\r
- \r
- WriteRegStr HKCR "${FILECLASS}" "" `${DESCRIPTION}`\r
- WriteRegStr HKCR "${FILECLASS}\DefaultIcon" "" `${ICON}`\r
- WriteRegStr HKCR "${FILECLASS}\shell" "" "open"\r
- WriteRegStr HKCR "${FILECLASS}\shell\open" "" `${COMMANDTEXT}`\r
- WriteRegStr HKCR "${FILECLASS}\shell\open\command" "" `${COMMAND}`\r
-!macroend\r
- \r
-!macro APP_ASSOCIATE_EX EXT FILECLASS DESCRIPTION ICON VERB DEFAULTVERB SHELLNEW COMMANDTEXT COMMAND\r
- ; Backup the previously associated file class\r
- ReadRegStr $R0 HKCR ".${EXT}" ""\r
- WriteRegStr HKCR ".${EXT}" "${FILECLASS}_backup" "$R0"\r
- \r
- WriteRegStr HKCR ".${EXT}" "" "${FILECLASS}"\r
- StrCmp "${SHELLNEW}" "0" +2\r
- WriteRegStr HKCR ".${EXT}\ShellNew" "NullFile" ""\r
- \r
- WriteRegStr HKCR "${FILECLASS}" "" `${DESCRIPTION}`\r
- WriteRegStr HKCR "${FILECLASS}\DefaultIcon" "" `${ICON}`\r
- WriteRegStr HKCR "${FILECLASS}\shell" "" `${DEFAULTVERB}`\r
- WriteRegStr HKCR "${FILECLASS}\shell\${VERB}" "" `${COMMANDTEXT}`\r
- WriteRegStr HKCR "${FILECLASS}\shell\${VERB}\command" "" `${COMMAND}`\r
-!macroend\r
- \r
-!macro APP_ASSOCIATE_ADDVERB FILECLASS VERB COMMANDTEXT COMMAND\r
- WriteRegStr HKCR "${FILECLASS}\shell\${VERB}" "" `${COMMANDTEXT}`\r
- WriteRegStr HKCR "${FILECLASS}\shell\${VERB}\command" "" `${COMMAND}`\r
-!macroend\r
- \r
-!macro APP_ASSOCIATE_REMOVEVERB FILECLASS VERB\r
- DeleteRegKey HKCR `${FILECLASS}\shell\${VERB}`\r
-!macroend\r
- \r
- \r
-!macro APP_UNASSOCIATE EXT FILECLASS\r
- ; Backup the previously associated file class\r
- ReadRegStr $R0 HKCR ".${EXT}" `${FILECLASS}_backup`\r
- WriteRegStr HKCR ".${EXT}" "" "$R0"\r
- \r
- DeleteRegKey HKCR `${FILECLASS}`\r
-!macroend\r
- \r
-!macro APP_ASSOCIATE_GETFILECLASS OUTPUT EXT\r
- ReadRegStr ${OUTPUT} HKCR ".${EXT}" ""\r
-!macroend\r
- \r
- \r
-; !defines for use with SHChangeNotify\r
-!ifdef SHCNE_ASSOCCHANGED\r
-!undef SHCNE_ASSOCCHANGED\r
-!endif\r
-!define SHCNE_ASSOCCHANGED 0x08000000\r
-!ifdef SHCNF_FLUSH\r
-!undef SHCNF_FLUSH\r
-!endif\r
-!define SHCNF_FLUSH 0x1000\r
- \r
-!macro UPDATEFILEASSOC\r
-; Using the system.dll plugin to call the SHChangeNotify Win32 API function so we\r
-; can update the shell.\r
- System::Call "shell32::SHChangeNotify(i,i,i,i) (${SHCNE_ASSOCCHANGED}, ${SHCNF_FLUSH}, 0, 0)"\r
-!macroend\r
- \r
-;EOF\r
+; fileassoc.nsh
+; File association helper macros
+; Written by Saivert
+;
+; Features automatic backup system and UPDATEFILEASSOC macro for
+; shell change notification.
+;
+; |> How to use <|
+; To associate a file with an application so you can double-click it in explorer, use
+; the APP_ASSOCIATE macro like this:
+;
+; Example:
+; !insertmacro APP_ASSOCIATE "txt" "myapp.textfile" "$INSTDIR\myapp.exe,0" \
+; "Open with myapp" "$INSTDIR\myapp.exe $\"%1$\""
+;
+; Never insert the APP_ASSOCIATE macro multiple times, it is only ment
+; to associate an application with a single file and using the
+; the "open" verb as default. To add more verbs (actions) to a file
+; use the APP_ASSOCIATE_ADDVERB macro.
+;
+; Example:
+; !insertmacro APP_ASSOCIATE_ADDVERB "myapp.textfile" "edit" "Edit with myapp" \
+; "$INSTDIR\myapp.exe /edit $\"%1$\""
+;
+; To have access to more options when registering the file association use the
+; APP_ASSOCIATE_EX macro. Here you can specify the verb and what verb is to be the
+; standard action (default verb).
+;
+; And finally: To remove the association from the registry use the APP_UNASSOCIATE
+; macro. Here is another example just to wrap it up:
+; !insertmacro APP_UNASSOCIATE "txt" "myapp.textfile"
+;
+; |> Note <|
+; When defining your file class string always use the short form of your application title
+; then a period (dot) and the type of file. This keeps the file class sort of unique.
+; Examples:
+; Winamp.Playlist
+; NSIS.Script
+; Photoshop.JPEGFile
+;
+; |> Tech info <|
+; The registry key layout for a file association is:
+; HKEY_CLASSES_ROOT
+; <applicationID> = <"description">
+; shell
+; <verb> = <"menu-item text">
+; command = <"command string">
+;
+
+!macro APP_ASSOCIATE EXT FILECLASS DESCRIPTION ICON COMMANDTEXT COMMAND
+ ; Backup the previously associated file class
+ ReadRegStr $R0 HKCR ".${EXT}" ""
+ WriteRegStr HKCR ".${EXT}" "${FILECLASS}_backup" "$R0"
+
+ WriteRegStr HKCR ".${EXT}" "" "${FILECLASS}"
+
+ WriteRegStr HKCR "${FILECLASS}" "" `${DESCRIPTION}`
+ WriteRegStr HKCR "${FILECLASS}\DefaultIcon" "" `${ICON}`
+ WriteRegStr HKCR "${FILECLASS}\shell" "" "open"
+ WriteRegStr HKCR "${FILECLASS}\shell\open" "" `${COMMANDTEXT}`
+ WriteRegStr HKCR "${FILECLASS}\shell\open\command" "" `${COMMAND}`
+!macroend
+
+!macro APP_ASSOCIATE_EX EXT FILECLASS DESCRIPTION ICON VERB DEFAULTVERB SHELLNEW COMMANDTEXT COMMAND
+ ; Backup the previously associated file class
+ ReadRegStr $R0 HKCR ".${EXT}" ""
+ WriteRegStr HKCR ".${EXT}" "${FILECLASS}_backup" "$R0"
+
+ WriteRegStr HKCR ".${EXT}" "" "${FILECLASS}"
+ StrCmp "${SHELLNEW}" "0" +2
+ WriteRegStr HKCR ".${EXT}\ShellNew" "NullFile" ""
+
+ WriteRegStr HKCR "${FILECLASS}" "" `${DESCRIPTION}`
+ WriteRegStr HKCR "${FILECLASS}\DefaultIcon" "" `${ICON}`
+ WriteRegStr HKCR "${FILECLASS}\shell" "" `${DEFAULTVERB}`
+ WriteRegStr HKCR "${FILECLASS}\shell\${VERB}" "" `${COMMANDTEXT}`
+ WriteRegStr HKCR "${FILECLASS}\shell\${VERB}\command" "" `${COMMAND}`
+!macroend
+
+!macro APP_ASSOCIATE_ADDVERB FILECLASS VERB COMMANDTEXT COMMAND
+ WriteRegStr HKCR "${FILECLASS}\shell\${VERB}" "" `${COMMANDTEXT}`
+ WriteRegStr HKCR "${FILECLASS}\shell\${VERB}\command" "" `${COMMAND}`
+!macroend
+
+!macro APP_ASSOCIATE_REMOVEVERB FILECLASS VERB
+ DeleteRegKey HKCR `${FILECLASS}\shell\${VERB}`
+!macroend
+
+
+!macro APP_UNASSOCIATE EXT FILECLASS
+ ; Backup the previously associated file class
+ ReadRegStr $R0 HKCR ".${EXT}" `${FILECLASS}_backup`
+ WriteRegStr HKCR ".${EXT}" "" "$R0"
+
+ DeleteRegKey HKCR `${FILECLASS}`
+!macroend
+
+!macro APP_ASSOCIATE_GETFILECLASS OUTPUT EXT
+ ReadRegStr ${OUTPUT} HKCR ".${EXT}" ""
+!macroend
+
+
+; !defines for use with SHChangeNotify
+!ifdef SHCNE_ASSOCCHANGED
+!undef SHCNE_ASSOCCHANGED
+!endif
+!define SHCNE_ASSOCCHANGED 0x08000000
+!ifdef SHCNF_FLUSH
+!undef SHCNF_FLUSH
+!endif
+!define SHCNF_FLUSH 0x1000
+
+!macro UPDATEFILEASSOC
+; Using the system.dll plugin to call the SHChangeNotify Win32 API function so we
+; can update the shell.
+ System::Call "shell32::SHChangeNotify(i,i,i,i) (${SHCNE_ASSOCCHANGED}, ${SHCNF_FLUSH}, 0, 0)"
+!macroend
+
+;EOF