Archive: File Association


File Association
I read through all the documentation but I am still having trouble with the following file association. Here are the requirements

1) A third party application installs itself under this HKCR
>ReadRegStr $0 HKCR "Applications\cView.exe\shell\open\command" ""
I can read this value with no problem (I get this string back: "C:\Program Files\cView\cView.exe" "%1")

2) Now I need to associate ".rpt" files with this application. I try doing the following:
;create file association
ReadRegStr $0 HKCR "Applications\cView.exe\shell\open\command" ""

WriteRegStr HKCR ".rpt" "" "Applications\cView.exe"
WriteRegStr HKCR ".rpt\DefaultIcon" "" $0,0

WriteRegStr HKCR "Applications\cView.exe" "" "cView File"
WriteRegStr HKCR "Applications\cView.exe\shell" "" "open"

It does not work!
Any help would be greatly appreciated.


ReadRegStr $0 HKCR "Applications\cView.exe\shell\open\command" ""

WriteRegStr HKCR ".rpt" "" "cView"

WriteRegStr HKCR "cView" "" "cView File"
WriteRegStr HKCR "cView\DefaultIcon" "" "$0,0"
WriteRegStr HKCR "cView\shell\open\command" "" "$0"


You should use the scripts on the NSIS Archive:

http://nsis.sourceforge.net/archive/...instances=0,11

-Stu


I got the association working but
I can not get DefaultIcon to work....the code I have so far is:
Function fileAssociation
;create file association
ReadRegStr $0 HKCR "Applications\cView.exe\shell\open\command" ""

StrCpy $9 " $\"%1$\""
StrCpy $1 $0
; remove end characters
Call removeFromString

; remove inital quote
StrCpy $9 "$\""
Call removeFromString

; remove end quote
StrCpy $9 "$\""
Call removeFromString

WriteRegStr HKCR ".rpt" "" "Applications\cView.exe"
WriteRegStr HKCR ".rpt\DefaultIcon" "" $1,0

WriteRegStr HKCR "Applications\cView.exe" "" "cView File"
WriteRegStr HKCR "Applications\cView.exe\shell" "" "open"


FunctionEnd


I've updated my code. Please try my code again.