ShiftyGypsy Posted June 29, 2007 Posted June 29, 2007 hi, i'm trying to automate the installation of kaspersky internet security 6.0 and have run into a strange problem. my autoitv3 script controls all the app windows up until one specific window. i can activate the window, get focus to controls on the window and send commands to controls but the commands don't work (and by "don't work", i mean the function returns success, but the action is not carried out (eg, clicking the "Next >" button)). here's my code (note the multiple, commented-out experiments): CODE Dim $exe_name = "c:\kis6.0.2.621en.exe" Dim $version = " 6.0" Dim $name = "Kaspersky Internet Security" Dim $base_title = $name & $version Dim $install_shield_title = $base_title & " - InstallShield Wizard" Dim $setup_title = "Setup Wizard: " & $name Run($exe_name) WaitForWindow($install_shield_title, "Please enter the folder") ControlClick($install_shield_title, "", "[TEXT:&Next >]") WaitForWindow($base_title, "Welcome to the Kaspersky Internet Security 6.0 Setup Wizard") ControlClick($base_title, "", "[TEXT:&Next >]") WaitForWindow($base_title, "End User License Agreement") ControlClick($base_title, "", "[TEXT:I &accept the terms of the License Agreement]") ControlClick($base_title, "", "[TEXT:&Next >]") WaitForWindow($base_title, "Select destination folder") ControlClick($base_title, "", "[TEXT:&Next >]") WaitForWindow($base_title, "Choose Setup Type") ControlClick($base_title, "", "[TEXT:Install only Anti-Virus features]") WaitForWindow($base_title, "Ready to install") ControlClick($base_title, "", "[TEXT:&Install]") WaitForWindow($base_title, "Installation complete") ControlClick($base_title, "", "[TEXT:&Next >]") WaitForWindow($setup_title, "") ControlClick($setup_title, "", "[TEXT:Activate &later]") ; Check "Activate later" checkbox ControlClick($setup_title, "", "[TEXT:&Next >]") ; Click "Next >" button WaitForWindow($setup_title, "Interactive protection") $ret = ControlFocus($setup_title, "", "AVP.Button45") if $ret = 0 then MsgBox(1, "xxx", "controlfocus failed!") ;$ret = ControlCommand($setup_title, "", "AVP.Button45", "IsEnabled", "") ;if $ret = 0 then MsgBox(1, "xxx", "control not enabled!") ;$ret = ControlSend($setup_title, "", "AVP.Button45", "{ENTER}") ;if $ret = 0 then MsgBox(1, "xxx", "controlsend failed!") $ret = ControlClick($setup_title, "", "AVP.Button45", "left", 1) if $ret = 0 then MsgBox(1, "xxx", "controlsend failed!") ;$ret = ControlClick($setup_title, "", "[iD:65039]") ;$ret = ControlClick($setup_title, "Interactive protection", "[TEXT:&Nxt >]") ; Click "Next >" button ;if $ret = 0 then MsgBox(1, "xxx", "controlclick1 failed!") WaitForWindow($setup_title, "Update mode") ControlClick($setup_title, "", "[TEXT:&Manually]") ; Check "Manually" checkbox ControlClick($setup_title, "", "[TEXT:&Next >]") ; Click "Next >" button WaitForWindow($setup_title, "Scan startup objects") ControlClick($setup_title, "", "[TEXT:&Next >]") ; Click "Next >" button WaitForWindow($setup_title, "Enable &password protection") ControlClick($setup_title, "", "[TEXT:&Next >]") ; Click "Next >" button WaitForWindow($setup_title, "&Restart computer") ControlClick($setup_title, "", "[TEXT:&Finish]") ; Click "Finish" button Func WaitForWindow($title, $text) WinWait($title, $text) WinActivate($title, $text) WinWaitActive($title, $text) EndFunc here's the output of autoitv3 wininfo: CODE >>>> Window <<<< Title: Setup Wizard: Kaspersky Internet Security Class: AVP.ConfigureWizard Position: 387, 264 Size: 506, 402 Style: 0x94CA0044 ExStyle: 0x00010100 >>>> Control <<<< Class: AVP.Button Instance: 45 ID: 42649 Text: &Next > Position: 727, 633 Size: 75, 23 ControlClick Coords: 35, 11 Style: 0x50010001 ExStyle: 0x00000000 >>>> Mouse <<<< Position: 762, 644 Cursor ID: 0 Color: 0xF3F3EF >>>> StatusBar <<<< >>>> Visible Text <<<< B&asic protection (recommended for most users) Notify me only about dangerous events &Interactive protection (recommended for experienced users) Notify me about dangerous and suspicious events < &Back &Next > &Cancel >>>> Hidden Text <<<< United States v($(KnownNetworks)) License key information Update mode Scan startup objects Scan critical areas Full computer scan Scope i've tried ControlClick, ControlSend with various control specifiers (ID, TEXT, INSTANCE) and plain old Send. the only other thing i should mention (if it matters), is that i'm running all this in a xpsp2 virtual machine. thanks in advance!
ShiftyGypsy Posted June 29, 2007 Author Posted June 29, 2007 hi,i'm trying to automate the installation of kaspersky internet security 6.0 and have run into a strange problem.my autoitv3 script controls all the app windows up until one specific window. i can activate the window, get focus tocontrols on the window and send commands to controls but the commands don't work (and by "don't work", i meanthe function returns success, but the action is not carried out (eg, clicking the "Next >" button)).here's my code (note the multiple, commented-out experiments):<SNIP>here's the output of autoitv3 wininfo:<SNIP>i've tried ControlClick, ControlSend with various control specifiers (ID, TEXT, INSTANCE) and plain old Send. the only other thing i should mention (if it matters), is that i'm running all this in a xpsp2 virtual machine.thanks in advance!i forgot to mention that it's at the "Interactive protection" window. also, since posting this, i tried using a simpler approach which also failed:CODEOpt("TrayIconDebug", 1)Opt("SendKeyDownDelay", 500)Opt("WinWaitDelay", 500)Run("c:\kis6.0.2.621en.exe")WinWaitActive("Kaspersky Internet Security 6.0 - InstallShield")Send("{ENTER}")WinWaitActive ("Kaspersky Internet Security 6.0", "This wizard will install")Send ("{ENTER}")WinWaitActive ("Kaspersky Internet Security 6.0", "End User License Agreement")Send ("{TAB}")Send ("{UP}")Send ("{ENTER}")WinWaitActive ("Kaspersky Internet Security 6.0", "Select destination folder")Send ("{ENTER}")WinWaitActive ("Kaspersky Internet Security 6.0", "Choose Setup Type")Send ("{TAB}")Send ("{TAB}")Send ("{ENTER}")WinWaitActive ("Kaspersky Internet Security 6.0", "Ready to install")Send ("{ENTER}")WinWaitActive ("Kaspersky Internet Security 6.0", "Installation complete")Send ("{ENTER}");WinWaitActive ("Setup Wizard: Kaspersky Internet Security", "Apply existing license key")WinWaitActive ("Setup Wizard: Kaspersky Internet Security", "Activate &later");Send ("{DOWN 3}")Send ("!l")Send ("{ENTER}");; this window never receives the send(ENTER) -- autoit returns success from the send and moves on to the next;; WinWaitActiveWinWaitActive ("Setup Wizard: Kaspersky Internet Security", "recommended for most users");Send ("!n") ; didn't work$ret = Send("{ENTER}")if $ret = 0 then MsgBox(1, "xxx", "send enter failed")WinWaitActive ("Setup Wizard: Kaspersky Internet Security", "Update mode");Send ("!n")Send("{ENTER}")WinWaitActive ("Setup Wizard: Kaspersky Internet Security", "At program startup");Send ("!n")Send("{ENTER}")WinWaitActive ("Setup Wizard: Kaspersky Internet Security", "Enable password protection") ;Send ("!n")Send("{ENTER}")WinWaitActive ("Setup Wizard: Kaspersky Internet Security", "Restart computer");Send ("!f")Send("{ENTER}");Send ("{TAB 4}");Send ("{SPACE}");Send ("{ENTER}")
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