Jump to content

Infinite loop ... do not want :-)


Go to solution Solved by PDowning,

Recommended Posts

While the other guys are figuring out my other thread, here's a new one. I seem to have created an infinite loop, something I haven't done since high school using Assembly, now that required talent o:) .   Here is the code:

#include <GUIConstantsEX.au3>
#include <EditConstants.au3>


GUICreate('Application Launcher',400,100) ;Create 'Please Wait' window
GUISetState(@SW_SHOW)
$wasabi=GUICtrlCreateLabel ('Installing Kaspersky Anti-Virus - Please Wait',95,45)

$KASProcess = "setup.exe"
While 1
    If Not ProcessExists($KASProcess) Then

        If FileExists("C:\Program Files\Kaspersky Lab\Kaspersky Endpoint Security 10 for Windows\avp.exe") Then
            MsgBox(0, "kas", "installed")
            ExitLoop
        Else
            ;MsgBox(0, "Installing Kaspersky Anti-Virus", " Please wait while KAS Installs ..... ")
            RunWait("\\tar-fs01\KLSHARE\PkgInst\NetAgent_10.0.3361_KES_10.1.0.867\setup.exe")
        EndIf
    EndIf
WEnd

Basically, check to see if the process "setup.exe" is running, if not see if the program is installed, if not, install it. If it is installed exit the loop(that part works if it's installed), otherwise install it before continuing the script.  This script will do this for several programs, not just this AV program.  Yet somehow I managed to get it to install itself over and over :censored: .   Failed logic again?

Link to comment
Share on other sites

Then why does it loop. When it gets to the end, the process setup.exe is no longer valid, so it SHOULD end. But it ends the If Not section, not the While 1 section. But even then, when it loops back around, doesn't see the process running, it checks to see if the file exists to show that it's been installed, and SHOULD exit the while loop. But it's not.

Link to comment
Share on other sites

  • Moderators

So you need to do some error checking - put in a couple of MsgBoxes to figure out where your logic is failing.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Yep, so either the file does not exist after the instal, or the installer is not there, or the installer is present, and no action is being performed on it...you are not passing silent install switches.

Do logging to see what's up...get the return of runwait, and log it...do a file check on the installer prior to running it...maybe the drive is not visible to the station?  Do some checking on that also.

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

If the setup program doesn't exist, then the setup will never be run, and so the loop will continue. Likewise if the path to the final file is incorrect then it will keep trying to run the setup.

There's a few things you should do:

  * Check whether the setup actually runs

  * Make sure the setup doesn't run more than once.

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...