Archive: link icon with file


link icon with file
Is it possible to link an icon with a file.
Like you can do manually with
- control panel - directoryproperties - filetypes.
Can you do this with the nsis-script... i have searched and nothing found but ?


Write key to regestry:
WriteRegStr HKCR "\".filetype"\DefaultIcon\" "" "path_to_icon"


i have tried :

Section "nma_link_ico" SEC10
SetOutPath "$ANOTHER_DIR\Noma\ND_profile.ico"
File "Noma\Graphics\Icons\"
WriteRegStr HKCR "\".nma"\DefaultIcon\" "$ANOTHER_DIR\Nomadisk\ND_profile.ico"
SectionEnd

AND

Section "nma_link_ico" SEC10
SetOutPath "$ANOTHER_DIR\Noma\ND_profile.ico"
File "Noma\Graphics\Icons\"
WriteRegStr HKCR ".nma\DefaultIcon\" "" "$ANOTHER_DIR\Nomadisk\ND_profile.ico"
SectionEnd

none works...(in the regestry there comes .nma with the path)but the link do not work


the format is: (ex. for .xxx, the file class is xxxFile)

HKCR ".xxx" "" "xxxFile"

HKCR "xxxFile\DefaultIcon\" "" "$pathtoicon"

http://msdn.microsoft.com/library/de.../fileassoc.asp


Yes. Anders right.
I wrote incorrect example. But in my own script I did it (file association) correct (like Anders wrote).
aj kwak sorry.


i does not work :confused:

;here i copy the ico files to the client computer
SetOutPath "$ANOTHER_DIR\Noma\"
File "Nomafiles\Graphics\Icons\*.ico"

;i give a name
WriteRegStr HKCR "nmdfile" "" "${PRODUCT_NAME}profile File"

;i associate the nmdfile with the icon
WriteRegStr HKCR "nmdfile\DefaultIcon\" "" "$ANOTHER_DIR\Noma\ND_profile.ico"


;because the associate with the ico doesn't work, i tried this, but i doesn't work also
WriteRegStr HKCR "nmdfile\DefaultIcon\" "" "$ANOTHER_DIR\Noma\NomaClient.exe,-120"


Add WriteRegStr HKCR ".nmd" "" "nmdfile",
where .nmd - extension of file.

EDIT

In general, you must define file class (see Anders link). For this, first create a registry key for the extension (.ext) under HKCR, and set the key's value to the ProgID for the associated application (WriteRegStr HKCR ".ext" "" "extfile" [extfile may change to any text, for example "ext.document", "documentext", "blabla"]).
Next, create a second key under HKCR for the application's ProgID. It's default value describes the application (what you see in - control panel - directoryproperties - filetypes).
Default value of DefaultIcon-subkey describes the default icon that you want to display for file types associated with this PROGID.
So your script must include:
WriteRegStr HKCR ".nmd" "" "nmdfile"
WriteRegStr HKCR "nmdfile\DefaultIcon" "" "path_to_ico"


Finnaly it works...

thx glory_man & Anders

For others :
WriteRegStr HKCR ".nmd" "" "nmdFile"
WriteRegStr HKCR "nmdfile" "" "${PRODUCT_NAME}profile File"
WriteRegStr HKCR "nmdFile\DefaultIcon\" "" "$ANOTHER_DIR\Noma\ND_profile.ico"

(a minimum of script i think)

EDIT

-


If you want to associate with file some actions - create additional subkeys.
For example, open file with programm:
WriteRegStr HKCR "nmdFile\Shell\open\command\" "" 'programm_path "%1"'


It's wonderful here..!!~~

Function un.oninit

SYSTEM::Call 'kernel32::CreateMutexA(i 0, i 0, t "myMutex") i .r1 ?e'
Pop $R0
StrCmp $R0 0 +2
Quit

Call un.cksundir

FindWindow $0 "Winamp v1.x"
StrCmp $0 0 +2
SendMessage $0 ${WM_CLOSE} 0 0
FindWindow $0 "WinampAgentMain"
StrCmp $0 0 +2
SendMessage $0 ${WM_CLOSE} 0 0

FunctionEnd:igor:


:igor:
Is this question?
:D