Open with... NSIS
i was wondering if/how i could register a filetype to be opened with a NSIS scripted program (blabla.exe filename.bla). the question would be how to hand over the file as variable within NSIS.
13 posts
ReadRegStr $1 HKCR ".nsi" ""
StrCmp $1 "" Label1
StrCmp $1 "NSISFile" Label1
WriteRegStr HKCR ".nsi" "backup_val" $1
Label1:
WriteRegStr HKCR ".nsh" "" "NSHFile"
ReadRegStr $0 HKCR "NSHFile" ""
StrCmp $0 "" 0 skipNSHAssoc
WriteRegStr HKCR "NSHFile" "" "NSIS Header File"
WriteRegStr HKCR "NSHFile\shell" "" "open"
WriteRegStr HKCR "NSHFile\DefaultIcon" "" $INSTDIR\makensisw.exe,1
skipNSHAssoc:
WriteRegStr HKCR "NSHFile\shell\open\command" "" 'notepad.exe "%1"'
WriteRegStr HKCR ".nsi" "" "NSISFile"
ReadRegStr $0 HKCR "NSISFile" ""
StrCmp $0 "" 0 skipNSIAssoc
WriteRegStr HKCR "NSISFile" "" "NSIS Script File"
WriteRegStr HKCR "NSISFile\shell" "" "open"
WriteRegStr HKCR "NSISFile\DefaultIcon" "" $INSTDIR\makensisw.exe,1
skipNSIAssoc:
WriteRegStr HKCR "NSISFile\shell\open\command" "" 'notepad.exe "%1"'
WriteRegStr HKCR "NSISFile\shell\compile" "" "Compile NSI"
WriteRegStr HKCR "NSISFile\shell\compile\command" "" '"$INSTDIR\makensisw.exe" "%1"'
WriteRegStr HKCR "NSISFile\shell\compile-bz2" "" "Compile NSI (with bz2)"
WriteRegStr HKCR "NSISFile\shell\compile-bz2\command" "" '"$INSTDIR\makensisw.exe" /X"SetCompressor bzip2" "%1"'
SectionEnd
Originally posted by Afrow UKthis is not quite true. i tested this in the command-line. openening a file containing no spaces in its name, $0 will not contain any quotes. when i open a file with spaces, windows requires using quotes, so $0 will contains quotes.
If the user opened up map.sla, then $0 would be "map.sla" (including quotes)