Announcement

Collapse
No announcement yet.

File Association

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

  • #2
    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"
    Last edited by Joost Verburg; 19 August 2003, 20:17.

    Comment


    • #3
      You should use the scripts on the NSIS Archive:



      -Stu

      Comment


      • #4
        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

        Comment


        • #5
          I've updated my code. Please try my code again.

          Comment

          Working...
          X
          😀
          🥰
          🤢
          😎
          😡
          👍
          👎