Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 17th April 2012, 11:25   #1
wagner1308
Junior Member
 
Join Date: Oct 2011
Posts: 14
Associate icon to files created with a certain extension

Good morning people,

I need your help, I joined two extensions on windows with Nisis now I want to associate an icon for each of the two extensions that I have created and joined in windows.

I did so to associate the extensions that create

HKEY_CLASSES_ROOT WriteRegStr "My.Extension.MYE" "" "My Extension MYE"
HKEY_CLASSES_ROOT WriteRegStr "My.Extension.MYE \ shell \ open \ command" "" "$ INSTDIR \ Meu_executavel.exe" "% 1" '
WriteRegStr HKEY_CLASSES_ROOT. "mye" "" "My.Extension.MYE"

then I tried to associate the icons adiconando this line:

HKEY_CLASSES_ROOT WriteRegStr "My.Extension.MYE \ DefaultIcon" "" "$ INSTDIR \ desenho.ico" "% 1" '

then the code looks like this:

HKEY_CLASSES_ROOT WriteRegStr "My.Extension.MYE" "" "My Extension MYE"
HKEY_CLASSES_ROOT WriteRegStr "My.Extension.MYE \ shell \ open \ command" "" "$ INSTDIR \ Meu_executavel.exe" "% 1" '
HKEY_CLASSES_ROOT WriteRegStr "My.Extension.MYE \ DefaultIcon" "" "$ INSTDIR \ desenho.ico" "% 1" '
WriteRegStr HKEY_CLASSES_ROOT. "mye" "" "My.Extension.MYE"

But I can not work as associate icons to files that have the extension I created?

Thank you!
wagner1308 is offline   Reply With Quote
Old 17th April 2012, 11:50   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,849
I think you shouldn't have a period after HKCR (x2).
MSG is offline   Reply With Quote
Old 17th April 2012, 12:10   #3
wagner1308
Junior Member
 
Join Date: Oct 2011
Posts: 14
Quote:
Originally Posted by MSG View Post
I think you shouldn't have a period after HKCR (x2).
I do not understand what you told me you could give me an example or change what I put there so I can try?

Thank you.
wagner1308 is offline   Reply With Quote
Old 17th April 2012, 12:29   #4
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,849
WriteRegStr HKEY_CLASSES_ROOT. "mye" "" "My.Extension.MYE"

you have a period there.
MSG is offline   Reply With Quote
Old 17th April 2012, 20:27   #5
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,813
DefaultIcon should look like:
c:\path\file.ico
c:\path\file.dll,3
c:\path\file.dll,-3
or
%1

If there is only one icon in the file you don't need the comma and number. Since this is not a command line, quotation marks are not necessary.
%1 only works if the filetype is bmp,ico,dll,cpl,exe etc.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 19th April 2012, 07:36   #6
antoniohl
Junior Member
 
Join Date: Apr 2012
Posts: 1
Smile try this Wagner ...

I do this using the default windows associations then i do some modifications, originally was ft000001 then i changed to ft000002, using export registry entries.

try this:
WriteRegStr HKCR ".app" "" "ft000002"
WriteRegStr HKCR "ft000002" "" ""
WriteRegDWORD HKCR "ft000002" "EditFlags" 0
WriteRegDWORD HKCR "ft000002" "BrowserFlags" 8
WriteRegStr HKCR "ft000002\DefaultIcon" "" "$INSTDIR\MyApp.exe,0"
WriteRegStr HKCR "ft000002\shell\open\command" "" '$INSTDIR\MyApp.exe "%1"'

where [.app] is a sample extension, change [MyApp.exe] to your application name.
in this fragment ['$INSTDIR\MyApp.exe "%1"'] we can use single externally to use double quotation internally.

Its all.
antonio
(meu ingles nao tah lah muito bom)
antoniohl is offline   Reply With Quote
Old 19th April 2012, 15:52   #7
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,813
You should quote the path: WriteRegStr HKCR "ft000002\shell\open\command" "" '"$INSTDIR\MyApp.exe" "%1"'

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump