AntiVirusGuy Posted December 21, 2006 Author Share Posted December 21, 2006 fixed it If MsgBox(36, 'Found:', $DisplayName & @CRLF & 'Has been Found, do you want to uninstall it?') = 6 Then RunWait($Uninstallstring) Else ;exit ; I removed this exit EndIf no I just need to exclude "my antivirus" while looking for "antivirus" Link to comment Share on other sites More sharing options...
FreeFry Posted December 21, 2006 Share Posted December 21, 2006 (edited) Actually, it finds all(for me it does), but it exits if you choose cancel... Well can't you name your antivirus something else than "My Antivirus"? Otherwise, you will have to check the $DisplayName for the name of your Antivirus.. ie. If $DisplayName = "My Antivirus" Then ContinueLoop I've updated the old code again, and added an variable which contains the name of the anti-virus you want to exclude Edited December 21, 2006 by FreeFry Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted December 21, 2006 Share Posted December 21, 2006 shouldnt it be If Not , and then exitloop ? cuz he doesnt want his anti virus.... Link to comment Share on other sites More sharing options...
FreeFry Posted December 21, 2006 Share Posted December 21, 2006 (edited) shouldnt it be If Not , and then exitloop ? cuz he doesnt want his anti virus.... Yes, it should be exitloop, though I added another if instead.. yours is less code doh Edit: Perhaps not, it would be like... If $DisplayName <> $Exclude And StringInStr($DisplayName, $MyApps[$i]) Then ... EndIf Edited December 21, 2006 by FreeFry Link to comment Share on other sites More sharing options...
AntiVirusGuy Posted December 21, 2006 Author Share Posted December 21, 2006 THis is what i have and i think it is perfect. on the off chance "my antivirus" is already installed I want to leave it and remove everything else then install my antivirus right over the top as it will not hurt the program it will just update the config. is this right? did iput the continue loop in the right place? Dim $SupportedApps = "Trend,McAfee,antivirus" ; Add more AV's here, separate them with a comma (,) Dim $MyApps = StringSplit($SupportedApps, ",") Dim $InstalledAppsCount = 1 Dim $Found = 0 TrayTip("Scanning...", "Scanning registry for installed AntiVirus(es).", 5) While 1 $SubKey = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", $InstalledAppsCount) If @error Then ExitLoop $DisplayName = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & $SubKey, "DisplayName") $Uninstallstring = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & $SubKey, "UninstallString") For $i = 1 To $MyApps[0] If StringInStr($DisplayName, $MyApps[$i]) Then $Found += 1 If $DisplayName = "my antivirus " Then ContinueLoop If MsgBox(36, 'Found:', $DisplayName & @CRLF & 'Has been Found, do you want to uninstall it?') = 6 Then RunWait($Uninstallstring) Else ;Exit EndIf EndIf Next $InstalledAppsCount += 1 WEnd If Not $Found Then MsgBox(64, "Not Found", "No existing Anti Virus found", 3) Else MsgBox(64, "Found", "Found " & $Found & " installed antivirus.") EndIf TrayTip("Installing", "New Antivirus", 30, 1) sleep(5000) RunWait(@TempDir & "\newav.exe") ProcessWait("setup.exe") ProcessWaitClose("setup.exe") TrayTip("", "", 0) MsgBox(64,"Success!", "Newav has Installed please reboot your computer", 4) Link to comment Share on other sites More sharing options...
FreeFry Posted December 21, 2006 Share Posted December 21, 2006 (edited) Please use autoit tags when you post code :| And no, there should be an ExitLoop instead of the ContinueLoop (my misstake in the first place) Though you have the updated code on the first page, which exludes any installed program that is named "My Antivirus" You really should look up every problem you come up against in the Help file, I learnt almost everything I know of autoit right from there. :| Edited December 22, 2006 by FreeFry 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