nsis script
hi
i am new using script
can u please solve my problem.
actually i want to add the fetcher.
if user click the second time installer file i want to display the message "already installer is there if u click ok means it will reinstall and install or click cancel."
some wt i can get the message success fully
but click ok means i cant able to call the uninstall
how to call the uninstall plz tell me
this is my function....
Function HandlePellucidPriorInstall
## Test for existence using the UninstallString
;ReadRegStr $R0 HKCU \
"Software\Pellucid\Common\xxx" ""
ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"UninstallString"
StrCmp $R0 "" noPriorInstall
## Get file version
;Making use of the Uninstall path to build the path to the exe
StrCpy $R1 $R0 -10
GetDllVersion "$R0\xxx.exe" $R2 $R3
;MessageBox MB_OK|MB_ICONSTOP $R2
;MessageBox MB_OK|MB_ICONSTOP $R3
IntOp $R4 $R2 / 0x00010000
IntOp $R5 $R2 & 0x0000FFFF
IntOp $R6 $R3 / 0x00010000
IntOp $R7 $R3 & 0x0000FFFF
IntCmp ${MAJOR_VERSION} $R4 +1 installedVersionHigher installedVersionLower
IntCmp ${MINOR_VERSION} $R5 +1 installedVersionHigher installedVersionLower
IntCmp ${BUILD} $R6 +1 installedVersionHigher installedVersionLower
IntCmp ${REVISION} $R7 sameVersionInstalled installedVersionHigher installedVersionLower
installedVersionHigher:
MessageBox MB_OK|MB_ICONSTOP \
"The Installer has detected that a NEWER version of ${PRODUCT_NAME} is already installed. $\n$\nThe installer will skip installation of ${PRODUCT_NAME}." /SD IDOK
strcpy $checkViewerPriorInstallationVersion "cancel"
return
sameVersionInstalled:
MessageBox MB_OK|MB_ICONSTOP \
"The Installer has detected that the SAME version of ${PRODUCT_NAME} is already installed. $\n$\nThe installer will skip installation of ${PRODUCT_NAME}." /SD IDOK
strcpy $checkViewerPriorInstallationVersion "cancel"
return
installedVersionLower:
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"Installer has detected that an older version of ${PRODUCT_NAME} . $\n$\nClick `OK` to proceed with removing the older version and replace with new version or `Cancel` to cancel this upgrade. $\n$\n Warning ! This operation will overwrite the Study database. You will need to import your old studies again." /SD IDOK \
IDOK beginUninstall
;strcpy $checkViewerPriorInstallationVersion "cancel"
!insertmacro CheckAppRunning `xxx.exe`
!insertmacro WControlPanelItem_Remove1 `yyyy`
; Delete TaskManager Related Files
; call un.onInit
; !insertmacro un.DeleteTaskManagerFiles
return
;Run the uninstaller
beginUninstall:
strcpy $checkPriorInstallationVersion "older"
return
noPriorInstall:
strcpy $checkPriorInstallationVersion "freshInstall"
Return
FunctionEnd
i am calling hear
var ALREADY_INSTALLED
Function .onVerifyInstDir
IfFileExists "$INSTDIR\xxx.exe" 0 new_installation
StrCpy $ALREADY_INSTALLED 1
Call HandlePriorInstall
new_installation:
FunctionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd
!macro WControlPanelItem_Remove1 `Name` 'InstallDirectory'
DeleteRegKey HKLM `SOFTWARE\Microsoft\Windows\CurrentVersion\UnInstall\${Name}`
!macroend
!insertmacro TaskRemoveService "xxxService.exe" "xxxService"
!insertmacro Removeyyy "yyyService.exe" "yyyService"
Section "Uninstall"
;!insertmacro CheckAppRunning `jjj.exe`
!insertmacro CheckAppRunning `mmm.exe`
!insertmacro WControlPanelItem_Remove1 `mmm``mmm`
; Delete TaskManager Related Files
ReadRegStr $TaskMgrInstallPath HKCU "Software\Pellucid\vvv\" ""
DetailPrint "$TaskMgrInstallPath - Path"
ReadRegStr $CommonPath HKCU "Software\Pellucid\Common\ConfigPath\" "Path"
DetailPrint "$CommonPath - Common Path"
;Remove Service
Call un.RemoveService
Call un.ddd
!insertmacro un.DeleteCommonFiles
!insertmacro un.Deleteddd
!insertmacro un.Deleteyyy
; Delete Reg Key
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey /ifempty HKCU "Software\Modern UI Test"
DeleteRegKey HKCU "Software\Pellucid\yyy"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
DeleteRegKey HKCR "rdd\shell\open\command"
DeleteRegKey HKCR "rdd\shell\open"
DeleteRegKey HKCR "rdd\shell"
DeleteRegKey HKCR "rdd\DefaultIcon"
DeleteRegKey HKCR "rdd"
SetAutoClose true
SectionEnd
i think i attach every thing so plz tell me function lo click ok means uninstall it will do
cancel means simply abort
thanking u.