Since most people aren't using Winamp anymore, I want the installer to detect a number of different programs on startup and then - before anything else - ask the user for which program they want to install the plugin. (For example Winamp, SAM Broadcaster, Station Playlist, AIMP, MediaMonkey).
So basically:
1. Check which programs are installed
2. Show a drop-down list and let them pick one
3. Show the directory where that program is installed (and they can change it if they want to for some reason), so basically just run the normal installer
For just one program it's pretty easy, for example this finds the install directory for Winamp:
And a bit later code like this can check whether there's actually a Winamp executable and plugins folder with files in it:
; The default installation directory
InstallDir $PROGRAMFILES\Winamp
; detect winamp path from uninstall string if available
InstallDirRegKey HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" \
"UninstallString"
This works fine for one program (and will find it if it's installed in a non-standard directory), but I can't figure out how to do this test for multiple programs, store all the directories, and ask the user which one to install before doing anything else.
IfFileExists $INSTDIR\Winamp.exe SkipIA
IfFileExists $INSTDIR\Plugins\*.* SkipIA2