kravi Posted February 8, 2007 Posted February 8, 2007 I'm trying to use AutoIT to enable the automated installation of a program. I'm using a piece of software that can remotely install patches and allows scripting. Currently, I have one executable which needs to be run (which opens up into a temp directory and automatically kicks off an installer). I have an autoit script I wrote that calls the initial executable. When the script is run manually everything works perfectly. Here is a copy of the script I've written: Run ("vs8cheese.exe") WinWait("McAfee VirusScan Enterprise Setup") WinActivate("McAfee VirusScan Enterprise Setup") Send("!n") WinWait("Network Associates Licensing", "Network Associates End User License Agreement") WinActivate("Network Associates Licensing") Send("!l") Send("p") Send("!a") Send("{ENTER}") WinWait("McAfee VirusScan Enterprise Setup", "Select Setup Type") WinActivate("McAfee VirusScan Enterprise Setup") Send("!n") WinWait("McAfee VirusScan Enterprise Setup", "The wizard is ready") WinActivate("McAfee VirusScan Enterprise Setup") Send("!i") WinWait("McAfee VirusScan Enterprise Setup", "has completed successfully") WinActivate("McAfee VirusScan Enterprise Setup") Send("!u") Send("!f") WinWait("McAfee VirusScan Enterprise Setup", "The") WinActivate("McAfee VirusScan Enterprise Setup") Send("{ENTER}") WinWait("VirusScan Setup", "must reboot your machine") WinActivate("VirusScan Setup") Send("!n") The problem is that when it is pushed by my software program (I discovered this by watching via the console) the initial box that needs to be played with is grayed out and doesn't activate as it should. Now, the initial executable that is being run, the "vs8cheese.exe" file, extracts itself into a temp directory and makes a call to another executable which runs a bunch (I think 2) of MSIs. I'm thinking that because the threads are launched seperately that autoit is not able to activate the window. If I'm connect to the console and manually click on the first "next" button the script kicks back in and runs everything. If I'm logged into the console before the package gets pushed, it runs perfectly. However if I'm not in on the console, it just hangs at that first screen. Any advice would be appreciated. --Adam
evilertoaster Posted February 8, 2007 Posted February 8, 2007 just looking at it in general it is somtiems nice to put window checks and such into a loop that doesn't break unti some error checking is met...that being said i knwo that some installers and msi cycle though windows sometimes and activate/deactive certian one off and on...maybe adding a winwaitactive in there somewhere? although i'm still not esactly sure what the issue is based on your desciption...what do you mean when you run in manually?
kravi Posted February 8, 2007 Author Posted February 8, 2007 just looking at it in general it is somtiems nice to put window checks and such into a loop that doesn't break unti some error checking is met...that being said i knwo that some installers and msi cycle though windows sometimes and activate/deactive certian one off and on...maybe adding a winwaitactive in there somewhere? although i'm still not esactly sure what the issue is based on your desciption...what do you mean when you run in manually?I had the WinWaitActives in there, but some of the screens that popped up didn't pop up active. I needed to activate them manually. I figured "better safe than sorry", so used the WinActivate for all of 'em. Could this be causing problems?--Me
evilertoaster Posted February 8, 2007 Posted February 8, 2007 maybe try somthing like - while winActive("McAfee VirusScan Enterprise Setup")=0 winactivate("McAfee VirusScan Enterprise Setup") wend shot in the dark
kravi Posted February 8, 2007 Author Posted February 8, 2007 maybe try somthing like -while winActive("McAfee VirusScan Enterprise Setup")=0winactivate("McAfee VirusScan Enterprise Setup")wendshot in the dark Thanks, mate, I'll give it a shot--Me
kravi Posted February 8, 2007 Author Posted February 8, 2007 Thanks, mate, I'll give it a shot--MeSame issue. It just doesn't activate the right window. As soon as I log into the console, however, it does highlight and the install proceeds.--Me
evilertoaster Posted February 8, 2007 Posted February 8, 2007 log on to the console? what do you mean? are you running this remotly?
kravi Posted February 8, 2007 Author Posted February 8, 2007 log on to the console? what do you mean? are you running this remotly?Yes, sorry, I thought I mentioned that before in the initial writeup.I have software that can push, well, anything. It also allows full scripting. Normally I'd just push the McAfee virus scan package and install it with the command line interface. however the command line interface does not allow the license to be set to perpetual (which the clients have) and only allows the license to be set to 1 year.So I thought that AutoIT would allow me to automate the gui based install (which would allow me to select perpetual as the license option). It works when I just run the script.However, because we are pushing this remotely (via a software app) it doesn't seem to quite work as it should. It hangs after calling the application initially (until I can log into the console and bring the first window into focus). That obviously will not work for our needs.--Adam
MHz Posted February 9, 2007 Posted February 9, 2007 If you want reliability then consider using WinWait() and Control*() functions that do not require active windows and ControlCommand() can be used to check if a control is disabled, else the change below may help with your issue. Using WinGetState() is another option to use if the whole window is disabled as you describe and sleep until it is enabled. Run ("vs8cheese.exe") _WinWaitActive("McAfee VirusScan Enterprise Setup") Send("!n") _WinWaitActive("Network Associates Licensing", "Network Associates End User License Agreement") Send("!l") Send("p") Send("!a") Send("{ENTER}") _WinWaitActive("McAfee VirusScan Enterprise Setup", "Select Setup Type") Send("!n") _WinWaitActive("McAfee VirusScan Enterprise Setup", "The wizard is ready") Send("!i") _WinWaitActive("McAfee VirusScan Enterprise Setup", "has completed successfully") Send("!u") Send("!f") _WinWaitActive("McAfee VirusScan Enterprise Setup", "The") Send("{ENTER}") _WinWaitActive("VirusScan Setup", "must reboot your machine") Send("!n") Exit Func _WinWaitActive($title, $text = '') WinWait($title, $text) Do Sleep(250) WinActivate($title, $text) Until WinActive($title, $text) WinWaitActive($title, $text) EndFunc
deltafx Posted July 6, 2007 Posted July 6, 2007 This is for McAfee VirusScan Enterprise 8.5 Run ("Setup.exe") _WinWaitActive("McAfee VirusScan Enterprise Setup") Send("!n") _WinWaitActive("McAfee Licensing", "McAfee End User License Agreement") Send("!l") Send("p") Send("!a") Send("{ENTER}") _WinWaitActive("McAfee VirusScan Enterprise Setup", "Select Setup Type") Send("!n") _WinWaitActive("McAfee VirusScan Enterprise Setup", "Select Access Protection Level") Send("!n") _WinWaitActive("McAfee VirusScan Enterprise Setup", "Ready to install") Send("!i") _WinWaitActive("McAfee VirusScan Enterprise Setup", "McAfee VirusScan Enterprise setup has completed successfully.") Send("!u") Send("!r") Send("!f") Exit Func _WinWaitActive($title, $text = '') WinWait($title, $text) Do Sleep(250) WinActivate($title, $text) Until WinActive($title, $text) WinWaitActive($title, $text) EndFunc
enaiman Posted July 6, 2007 Posted July 6, 2007 It is now like an old issue ...When a script hangs waiting for a window to become active (WinWaitActive) and you've used a long title (the whole title of the application - e.g. "McAfee VirusScan Enterprise Setup" ) then you should add Opt("WinTitleMatchMode", 2)and shorten the tile used to something significant (like "Enterprise Setup" or something else); shortening the text used can also be a good idea.- an useful thing for debugging is Opt("TrayIconDebug", 1) SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
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