InstallDir "$PROGRAMFILES\WINAMP\" Function .onInit ; loading regkey of winamp2 into $1 ReadRegStr $1 HKLM \ "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" \ "UninstallString" ;loading regkey of winamp3 into $2 ReadRegStr $2 HKLM \ "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp3" \ "UninstallString" StrCmp $1 "" nowa2 wa2 ; ckecking for winamp2 nowa2: ; no winamp2 found StrCmp $2 "" nowa30 wa30 ; ckecking for winamp3 nowa30: ; no regkey found at all ;DO NOTHING Goto ready wa30: ; winamp3 found StrCpy $INSTDIR $2 Call StripPath Goto ready wa2: ; winamp2 found StrCmp $2 "" nowa31 wa31 ; checking for winamp3 nowa31: ; no winamp3 found StrCpy $INSTDIR $1 Call StripPath Goto ready wa31: ; both versions found MessageBox MB_YESNO "It seems you've got Winamp2 AND Winamp3 on your system. Install into Winamp3?. (NO will install into Winamp2)" IDNO winamp2 StrCpy $INSTDIR $2 Call StripPath Goto ready winamp2: StrCpy $INSTDIR $1 Call StripPath Goto ready ready: FunctionEND Function StripPath Push $1 Push $2 StrCmp $INSTDIR "" fin StrCpy $1 $INSTDIR 1 0 ; get firstchar StrCmp $1 '"' "" getparent ; if first char is ", let's remove "'s first. StrCpy $INSTDIR $INSTDIR "" 1 StrCpy $1 0 rqloop: StrCpy $2 $INSTDIR 1 $1 StrCmp $2 '"' rqdone StrCmp $2 "" rqdone IntOp $1 $1 + 1 Goto rqloop rqdone: StrCpy $INSTDIR $INSTDIR $1 getparent: ; the uninstall string goes to an EXE, let's get the directory. StrCpy $1 -1 gploop: StrCpy $2 $INSTDIR 1 $1 StrCmp $2 "" gpexit StrCmp $2 "\" gpexit IntOp $1 $1 - 1 Goto gploop gpexit: StrCpy $INSTDIR $INSTDIR $1 fin: Pop $2 Pop $1 FunctionEnd Function .onVerifyInstDir IfFileExists $INSTDIR\Winamp.exe winamp2 IfFileExists $INSTDIR\Studio.exe winamp3 MessageBox MB_YESNO "It seems that the current directory does not contain winamp. Continue installing?" IDYES nowinamp Abort nowinamp: StrCpy $6 "AVS" Goto install winamp2: StrCpy $6 "PLUGINS\AVS" Goto install winamp3: StrCpy $6 "WACS\DATA\AVS" Goto install install: FunctionEnd SetOverwrite on Section "Install MYAVS" SetOutPath "$INSTDIR\$6\MYAVS" File "C:\PROGRAMME\WINAMP\PLUGINS\AVS\MYAVS\*.avs" SectionEnd