sahra Posted February 11, 2010 Share Posted February 11, 2010 i make silent install and i use this:$PreviousInstallation = RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Registry Mechanic_is1", "InstallLocation")If StringRight($PreviousInstallation, 1) = '\' Then $PreviousInstallation = StringTrimRight($PreviousInstallation, 1)EndIfIf FileExists($PreviousInstallation & "\RegMech.exe") Then MsgBox(0x40010, "Registry Mechanic 9", "Please uninstall previous version of Registry Mechanic before install the progarm..") Exit DirRemove(@AppdataDir & "\Registry Mechanic 9", 1)EndIfits not remove "Registry Mechanic 9" because the script process need to close and then remove the folder so i don't know what to doi want that after or before pressing OK button "Registry Mechanic 9" folder in AppdataDir will be removedthanks you Link to comment Share on other sites More sharing options...
gunsmokingman Posted February 11, 2010 Share Posted February 11, 2010 Since I do not know this scripting langauge, I would assume the reason you cant delete folder because it exit before the deletes happens. If FileExists($PreviousInstallation & "\RegMech.exe") Then MsgBox(0x40010, "Registry Mechanic 9", "Please uninstall previous version of Registry Mechanic before install the progarm..") Exit DirRemove(@AppdataDir & "\Registry Mechanic 9", 1) EndIfThat the way I read this script perhaps try changing it to thisIf FileExists($PreviousInstallation & "\RegMech.exe") Then MsgBox(0x40010, "Registry Mechanic 9", "Please uninstall previous version of Registry Mechanic before install the progarm..") DirRemove(@AppdataDir & "\Registry Mechanic 9", 1) ExitEndIf Link to comment Share on other sites More sharing options...
Yzöwl Posted February 11, 2010 Share Posted February 11, 2010 I'm with GSM here, it appears that you are Exiting within the If FileExists but before the DirRemove is invoked. I don't use AutoIt myself but would expect the end user would click the OK button to close the MsgBox, which would lead in turn to the directory removal you intended, before EndIf was stated.My best guess is that you actually meant to use Else before ExitIf FileExists($PreviousInstallation & "\RegMech.exe") Then MsgBox(0x40010, "Registry Mechanic 9", "Please uninstall previous version of Registry Mechanic before install the program..") Else Exit DirRemove(@AppdataDir & "\Registry Mechanic 9", 1)EndIfor in the order GSM suggestedIf FileExists($PreviousInstallation & "\RegMech.exe") Then MsgBox(0x40010, "Registry Mechanic 9", "Please uninstall previous version of Registry Mechanic before install the program..") DirRemove(@AppdataDir & "\Registry Mechanic 9", 1) Else ExitEndIfThat said, I actually think that your installer would be wrong either way. If you want the end user to uninstall the application themselves, then you should also at least afford them the opportunity to decide upon the removal of the Application Data. Your intent currently appears that you're going to remove that folder, (the name of which you've strangely hardcoded) and do so without asking. If the enduser then decides against an uninstall, the data removal would have been to their detriment.If you really don't care about what the end user wants then I'd also suggest that whilst RegReading that key, you'd also parse the uninstall subkey and actually perform the uninstallation yourself using that value data. Upon the success of that, you'd be in a better position to remove the intended directory without issue. Link to comment Share on other sites More sharing options...
MHz Posted February 12, 2010 Share Posted February 12, 2010 its not remove "Registry Mechanic 9" because the script process need to close and then remove the folder so i don't know what to doi want that after or before pressing OK button "Registry Mechanic 9" folder in AppdataDir will be removedI will take the "i don't know what to do" as flawed logic in your script and explanation. Thus we can only guess at what you may need?My best guess is that you actually meant to use Else before ExitI am going to go with that statement but use Else after Exit. It seems more logical to me considering that the Appdata <program> settings folder should be removed at the start of installation if it is a requirement.; get the install path from registry$PreviousInstallation = RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Registry Mechanic_is1", "InstallLocation")If StringRight($PreviousInstallation, 1) = '\' Then $PreviousInstallation = StringTrimRight($PreviousInstallation, 1)EndIf; check if installedIf $PreviousInstallation <> "" And FileExists($PreviousInstallation & "\RegMech.exe") Then ; show message and then Exit script as already installed MsgBox(0x40010, "Registry Mechanic 9", "Please uninstall previous version of Registry Mechanic before install the progarm..") Exit 1Else ; remove old settings (and start installation below) DirRemove(@AppdataDir & "\Registry Mechanic 9", 1)EndIf; start installation@sahraAttempt to comment your code and it may help you to interpret the logic of your script. It may help others also. Link to comment Share on other sites More sharing options...
Yzöwl Posted February 12, 2010 Share Posted February 12, 2010 That thought process makes a little more sense to me, however the hard-coding of the Appdata directory name now makes less sense. If there's already a 'Reg Mech 9' directory there but no uninstall registry data, then they've already removed 'the most recent version' of the application. Why then would they want to install a repack of it? If they did why wouldn't they wish to maintain its previous data? Link to comment Share on other sites More sharing options...
sahra Posted February 14, 2010 Author Share Posted February 14, 2010 its steal doesn't work for me i don't know why its not remove the Dir.i just want that if the MsgBox pop up so it will remove the installation Dir but if MsgBox not pop up so it remove the installation Dir after installation complete Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now