Jump to content

multiple variable


Recommended Posts

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"? :P

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 by FreeFry
Link to comment
Share on other sites

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

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" :P

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 by FreeFry
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...