PDowning Posted June 11, 2013 Posted June 11, 2013 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 . 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 . Failed logic again?
Blue_Drache Posted June 11, 2013 Posted June 11, 2013 I don't see anything wrong with this loop or the logic. Cosmetically, I'd use GuiSetState(@SW_SHOW) inside your Else statement instead of the custom msgbox. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
Moderators JLogan3o13 Posted June 11, 2013 Moderators Posted June 11, 2013 The only thing that strikes me is if your path to the avp.exe is incorrect. "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!
jdelaney Posted June 11, 2013 Posted June 11, 2013 Or, you are looking for the wrong dir...try using @ProgramFilesDir instead of C:program files 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.
PDowning Posted June 11, 2013 Author Posted June 11, 2013 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.
Moderators JLogan3o13 Posted June 11, 2013 Moderators Posted June 11, 2013 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!
jdelaney Posted June 11, 2013 Posted June 11, 2013 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.
Mat Posted June 11, 2013 Posted June 11, 2013 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. AutoIt Project Listing
PDowning Posted June 11, 2013 Author Posted June 11, 2013 (edited) added a few strategically placed msgbox's and we'll see where it gets me Edit: spelling errors Edited June 11, 2013 by PDowning
Solution PDowning Posted June 11, 2013 Author Solution Posted June 11, 2013 got it sorted out. Turns out the install was failling when running it from the server for some reason. Copied the file to c: and ran from there and it works like a charm.
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