Sign in to follow this  
Followers 0
dbecker

multiple regreads within If..then..else statement

6 posts in this topic

I dunno if it's just a problem with syntax but I can't get this statement to fly..

If RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\Shared Components", "") 
    Or
   RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\VirusScan Enterprise", "") 
    Or
   RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\McAfee\VirusScan", "") 
    Or
   RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\ePolicy Orchestrator", "") 
    Or
   RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\VirusScan", "")
    Or
   RegRead ("HKEY_LOCAL_MACHINE\Software\McAfee", "") 
    Or
   RegRead ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD", "") 
    Or
   RegRead ("HKEY_LOCAL_MACHINE\Software\Network Associates", "") 
    Or
   RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\McAfee", "")
    Or
   RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppPaths", "") 
Then MsgBox (0, "Please Read", "Setup has detected that you have a version of McAfee AntiVirus software on your computer, which may interfere with Norton. Please contact the Support Desk for assistance.")
Exit
Else
DirCreate("C:\NavInstall")
EndIf
;Compile NAV Install Files
FileInstall("C:\Documents and Settings\David Becker\My Documents\Work\Norton Installer\SAV\instmsiw.exe", "C:\NavInstall\instmsiw.exe")
FileInstall("C:\Documents and Settings\David Becker\My Documents\Work\Norton Installer\SAV\Setup.exe", "C:\NavInstall\Setup.exe")
FileInstall("C:\Documents and Settings\David Becker\My Documents\Work\Norton Installer\SAV\Data1.cab", "C:\NavInstall\Data1.cab")
FileInstall("C:\Documents and Settings\David Becker\My Documents\Work\Norton Installer\SAV\VDefHub.zip", "C:\NavInstall\VDefHub.zip")
FileInstall("C:\Documents and Settings\David Becker\My Documents\Work\Norton Installer\SAV\0x0409.ini", "C:\NavInstall\0x0409.ini")
FileInstall("C:\Documents and Settings\David Becker\My Documents\Work\Norton Installer\SAV\Setup.ini", "C:\NavInstall\Setup.ini")
FileInstall("C:\Documents and Settings\David Becker\My Documents\Work\Norton Installer\SAV\Symantec Antivirus.msi", "C:\NavInstall\Symantec Antivirus.msi")

;Compile Autoit Script to install NAV
FileInstall("C:\Documents and Settings\David Becker\My Documents\Work\Norton Installer\Norton 10 au3 installer\Navinstall.exe", "C:\NavInstall\Navinstall.exe")
FileInstall("C:\Documents and Settings\David Becker\My Documents\Work\Norton Installer\Norton 10 au3 installer\NavinstallDry.exe", "C:\NavInstall\NavinstallDry.exe")

;Completion Message Box
;MsgBox(0, "Norton Installation", "Norton Antivirus will now be installed. Please Click OK to continue...")

;Waits for the user to click ok on the message box before proceeding
;WinWaitClose("Norton Installation")

   Dim $response

   $response = MsgBox(4, "Installation Options", "Do you have an older version of APU's Norton Antivirus currently installed on your computer?")

   If $response = 6 Then
   Run("C:\NavInstall\Navinstall.exe")

   Else
   Run ("C:\NavInstall\NavinstallDry.exe")
   EndIf

"I wish I could say something that was classy and inspirational, but that just wouldn't be our style. Pain heals. Chicks dig scars. Glory lasts forever." - Shane Falco, The Replacements

Share this post


Link to post
Share on other sites



I dunno if it's just a problem with syntax but I can't get this statement to fly..

If RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\Shared Components", "") 
    Or
   RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\VirusScan Enterprise", "") 
    Or
   RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\McAfee\VirusScan", "") 
    Or
   RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\ePolicy Orchestrator", "") 
    Or
   RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\VirusScan", "")
    Or
   RegRead ("HKEY_LOCAL_MACHINE\Software\McAfee", "") 
    Or
   RegRead ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD", "") 
    Or
   RegRead ("HKEY_LOCAL_MACHINE\Software\Network Associates", "") 
    Or
   RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\McAfee", "")
    Or
   RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppPaths", "") 
Then MsgBox (0, "Please Read", "Setup has detected that you have a version of McAfee AntiVirus software on your computer, which may interfere with Norton. Please contact the Support Desk for assistance.")
Exit
Else
DirCreate("C:\NavInstall")
EndIf
;Compile NAV Install Files
FileInstall("C:\Documents and Settings\David Becker\My Documents\Work\Norton Installer\SAV\instmsiw.exe", "C:\NavInstall\instmsiw.exe")
FileInstall("C:\Documents and Settings\David Becker\My Documents\Work\Norton Installer\SAV\Setup.exe", "C:\NavInstall\Setup.exe")
FileInstall("C:\Documents and Settings\David Becker\My Documents\Work\Norton Installer\SAV\Data1.cab", "C:\NavInstall\Data1.cab")
FileInstall("C:\Documents and Settings\David Becker\My Documents\Work\Norton Installer\SAV\VDefHub.zip", "C:\NavInstall\VDefHub.zip")
FileInstall("C:\Documents and Settings\David Becker\My Documents\Work\Norton Installer\SAV\0x0409.ini", "C:\NavInstall\0x0409.ini")
FileInstall("C:\Documents and Settings\David Becker\My Documents\Work\Norton Installer\SAV\Setup.ini", "C:\NavInstall\Setup.ini")
FileInstall("C:\Documents and Settings\David Becker\My Documents\Work\Norton Installer\SAV\Symantec Antivirus.msi", "C:\NavInstall\Symantec Antivirus.msi")

;Compile Autoit Script to install NAV
FileInstall("C:\Documents and Settings\David Becker\My Documents\Work\Norton Installer\Norton 10 au3 installer\Navinstall.exe", "C:\NavInstall\Navinstall.exe")
FileInstall("C:\Documents and Settings\David Becker\My Documents\Work\Norton Installer\Norton 10 au3 installer\NavinstallDry.exe", "C:\NavInstall\NavinstallDry.exe")

;Completion Message Box
;MsgBox(0, "Norton Installation", "Norton Antivirus will now be installed. Please Click OK to continue...")

;Waits for the user to click ok on the message box before proceeding
;WinWaitClose("Norton Installation")

   Dim $response

   $response = MsgBox(4, "Installation Options", "Do you have an older version of APU's Norton Antivirus currently installed on your computer?")

   If $response = 6 Then
   Run("C:\NavInstall\Navinstall.exe")

   Else
   Run ("C:\NavInstall\NavinstallDry.exe")
   EndIf
alot of langugages limit how many conditions you can make for an if statement, i haven't run into a limit with autoit, but i haven't tried having that many conditions either. one thing you're going to run into issues with though, is that the condition will always evaluate to true, as regread() will never return a 0, unless the value of the key being read is 0

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

alot of langugages limit how many conditions you can make for an if statement, i haven't run into a limit with autoit, but i haven't tried having that many conditions either. one thing you're going to run into issues with though, is that the condition will always evaluate to true, as regread() will never return a 0, unless the value of the key being read is 0

yeah, that may be the case. the error message says that it's an If statement w/out a Then, and marks the error at the first regread statement. I think I have a way to work around this, I just wanted to see if I was just doing something blatantly incorrect.

"I wish I could say something that was classy and inspirational, but that just wouldn't be our style. Pain heals. Chicks dig scars. Glory lasts forever." - Shane Falco, The Replacements

Share this post


Link to post
Share on other sites

yeah, that may be the case. the error message says that it's an If statement w/out a Then, and marks the error at the first regread statement. I think I have a way to work around this, I just wanted to see if I was just doing something blatantly incorrect.

well it doesn't look like you're using the line continuation character: "_" to let the compiler know to carry down multiple lines. you also have a statement on the same line as your 'then' so it will only execute that one statement if it does recognize it as a valid 'Then". the thing to do would be to put all of your 'condition1 or condition2 or ..." on one long line, then move the statement after the "Then" down one line.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

well it doesn't look like you're using the line continuation character: "_" to let the compiler know to carry down multiple lines. you also have a statement on the same line as your 'then' so it will only execute that one statement if it does recognize it as a valid 'Then". the thing to do would be to put all of your 'condition1 or condition2 or ..." on one long line, then move the statement after the "Then" down one line.

ahh heh heh that did it. wunderbar.

"I wish I could say something that was classy and inspirational, but that just wouldn't be our style. Pain heals. Chicks dig scars. Glory lasts forever." - Shane Falco, The Replacements

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

ahh heh heh that did it. wunderbar.

np, glad to help

***edit*** also about my note before, the numbers i saw in the help file for the returns are not actually the returns, but the @error code. on failure, 0 IS returned, so a failed regread will fail your condition as you intend.

Edited by cameronsdad

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
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
Sign in to follow this  
Followers 0