Archive: New File Extention


New File Extention
Can be registered a new file extention with NSIS? What is the command?


http://nsis.sourceforge.net/wiki/File_Association


Although the example that Comperio is pointing you to works fine, I prefer to register extentions for the local machine rather than the current user. Instead of using HKCU\.opt (on the above WIKI example) I use HKLM\Software\Classes\.opt. This way the extention association will be available to any user that uses the computer rather than only the user that installed the software.
CF



!define Index "Line${__LINE__}"
ReadRegStr $1 HKCR ".slp" ""
StrCmp $1 "" "${Index}-NoBackup"
StrCmp $1 "Starlight2" "${Index}-NoBackup"
WriteRegStr HKCR ".slp" "backup_val" $1
"${Index}-NoBackup:"
WriteRegStr HKCR ".slp" "" "Starlight2"
ReadRegStr $0 HKCR "Starlight2" ""
StrCmp $0 "" 0 "${Index}-Skip"
WriteRegStr HKCR "Starlight2" "" "Starlight mp3 player playlist"
WriteRegStr HKCR "Starlight2\shell" "" "open"
WriteRegStr HKCR "Starlight2\DefaultIcon" "" "$INSTDIR\mIRC.exe,0"
"${Index}-Skip:"
WriteRegStr HKCR "Starlight2\shell\open\command" "" \
'$INSTDIR\mIRC.exe "%1"'
WriteRegStr HKCR "Starlight2\shell\edit" "" "Edit Options File"
WriteRegStr HKCR "Starlight2\shell\edit\command" "" \
'$INSTDIR\mIRC.exe "%1"'

System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
!undef Index



!define: "Index"="Line153"
Error: command ReadRegStr not valid outside section or function
Error in script "C:\Documents and Settings\BOAG\Documenti\Starlight\myscript.nsi" on line 154 -- aborting creation process

You need to put it in a Function or a Section as it says :p

-Stu