Archive: Associations in Win7 with NSIS


Associations in Win7 with NSIS
Hi,
I would like to ask about creating associations with NSIS installer in Windows Vista/7.
I found few ways to do this, but it seems none of them works correctly.

I tested for example this:
- http://nsis.sourceforge.net/Applicat...ration_plug-in
This is not working for me (if I manually add few registrykeys, it can work...)

- http://nsis.sourceforge.net/File_Association (this doeasnt work either - I mean not for all cases).

Lets say, we want to associate an MP3 extension with some media player, let's say AIMP.
How to do this correctly? In my tests, Windows Media Player always want to be default player... wrr
I am waiting for your ideas...
Thanks,
-Pawel


The code in makensis.nsi for NSI/NSH works fine on Windows 7.

Stu


No, it doeasnt work.
The problem is that WMP is default player for all audio files (when you open WMP and select auto settings it will associate it all to WMP).
After this, when I ty to associate MP3 extension to AIMP it is not working. Just tested makensis code...
So, is there any simple method to make AIMP (or any other player) as default player?



Ps: I did some tests, and I did it. I used this (http://nsis.sourceforge.net/Applicat...ration_plug-in) plugin.

StrCpy $0 "AIMP"
StrCpy $1 ".mp3"
StrCpy $2 "file"
AppAssocReg::SetAppAsDefault "$0" "$1" "$2"


But to make it work, I had to add first few entries to registry (for example: I had to manually add AIMP to registered applicatons:
[HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications]
"AIMP"="Software\\Clients\\Media\\AIMP\\Capabilities"

then fill data for this:

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Media\AIMP]
@="AIMP"

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Media\AIMP\Capabilities]
"ApplicationName"="AIMP"
"ApplicationDescription"="AIMP - Music Player"

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Media\AIMP\Capabilities\FileAssociations]
".mp3"="AIMP.AssocFile.MP3"

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Media\AIMP\DefaultIcon]
@="C:\\Program Files\\TC UP\\PLUGINS\\Media\\AIMP\\AIMP2.exe,1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Media\AIMP\InstallName]

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Media\AIMP\shell]

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Media\AIMP\shell\open]

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Media\AIMP\shell\open\command]
@=hex(2):22,00,43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,20,\
00,46,00,69,00,6c,00,65,00,73,00,5c,00,54,00,43,00,20,00,55,00,50,00,5c,00,\
50,00,4c,00,55,00,47,00,49,00,4e,00,53,00,5c,00,4d,00,65,00,64,00,69,00,61,\
00,5c,00,41,00,49,00,4d,00,50,00,5c,00,41,00,49,00,4d,00,50,00,32,00,2e,00,\
65,00,78,00,65,00,22,00,20,00,22,00,25,00,31,00,22,00,00,00

and finally make it work with:

[HKEY_CLASSES_ROOT\.mp3]
"PerceivedType"="audio"
@="AIMP.AssocFile.MP3"
"Content Type"="audio/mpeg"

[HKEY_CLASSES_ROOT\.mp3\OpenWithProgIds]
"AIMP.AssocFile.MP3"=hex(0):

How do you think? Is there simpler method? Or maybe I am doing it totally wrong?
-Pawel