Archive: Need File association help


Need File association help
Hi

I am trying to set a file assocation for my application
I am trying the script by Vytautas on the NSIS site
http://nsis.sourceforge.net/wiki/File_Association.
However I am having trouble and dont understand what is going wrong.
If I check the registry after runing the script I can see that under HOT KEY CLASSES ROOT their is a folder called .riverDoc.
I also have a folder called RiverDocs.riverDoc, contained within this are two more folders one called RiverDocsIcon.ico and the shell folder which contains the Edit and Open commands.

If I highlight the .riverDoc folder the registry shows the following information
Name Type Data
(Default) Reg_SZ RiverDoc.riverDoc

If I highlight the RiverDoc.riverDoc folder the registry shows the following information

Name Type Data
(Default) Reg_SZ RiverDoc File
EditFlags Reg_DWORD 0x00000000 (0)

The entry for the RiverDocsIcon reads
Name Type Data
(Default) REG_SZ c:\program files\RiverDocs\RiverDoc.exe,0

If I highlight the edit or the open folder I see for edit
Name Type Data
(Default) REG_SZ edit
and for open
Name Type Data
(Default) REG_SZ Value not set

The shell edit command folder highlighted reads
Name Type Data
(Default) REG_SZ c:\program files\RiverDocs\RiverDoc.exe"%1"

The shell open command folder highlighted reads
Name Type Data
(Default) REG_SZ c:\program files\RiverDocs\RiverDoc.exe"%1"

The problem that I am having is that when I check the file assocations in explorer folder options I can see in file types
Extension FileTypes
RIVERDOC RiverDocs File

When I go to the advanced option edit and open appear in the actions panel RiverDocs File appears in the textfiels beside the change icon button. If I choose to highlight the edit or open action and choose edit button I get the proper path in the application used to perform action
C:\Program Files\RiverDocs\RiverDoc.exe "%1"

Thsi all seeams ok but if I try to open a file of type riverdoc it just wont work. Windows asks me to choose the program to open the file. Also the Icons are not appearing in the file assocation in explorer folder options file types nor on the document that I am trying to open. Sorry if this is a bit long winded but I would apprecate any help in pointing out what I am doing wrong and how I might fix it. I have trawled the site and seen similar questions but no answers that work for me yet.

many thanks


!define Index "Line${__LINE__}"
ReadRegStr $1 HKCR ".riverdoc" ""
StrCmp $1 "" "${Index}-NoBackup"
StrCmp $1 "RiverDocs.riverdoc" "${Index}-NoBackup"
WriteRegStr HKCR ".riverDoc" "backup_val" $1
"${Index}-NoBackup:"
WriteRegStr HKCR ".riverDoc" "" "RiverDocs.riverDoc"
ReadRegStr $0 HKCR "RiverDocs.riverDoc" ""
StrCmp $0 "" 0 "${Index}-Skip"
WriteRegStr HKCR "RiverDocs.riverdoc" "" "RiverDocs File"
WriteRegStr HKCR "RiverDocs.riverdoc\shell" "" "open"
WriteRegStr HKCR "RiverDocs.riverdoc\RiverDocsIcon.ico" "" "$INSTDIR\RiverDoc.exe,0"
"${Index}-Skip:"
WriteRegStr HKCR "RiverDocs.riverdoc\shell\open\command" "" \
'$INSTDIR\RiverDoc.exe "%1"'
WriteRegStr HKCR "RiverDocs.riverdoc\shell\edit" "" "Edit"
WriteRegStr HKCR "RiverDocs.riverdoc\shell\edit\command" "" \
'$INSTDIR\RiverDoc.exe "%1"'

!define SHCNE_ASSOCCHANGED 0x8000000
!define SHCNF_IDLIST 0
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
;System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
;System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'


Try putting quotes around the program path in the registry shell commands. When you write the shell edit and open commands, try '"$INSTDIR\Riverdoc.exe" "%1"'. (single quotes around two quoted strings).

Don


thanks for the reply I will try this