IlGab Posted January 20, 2015 Share Posted January 20, 2015 Good morning, I'm trying to automate a software installation for HP tools. All works great until I can't control a popup windows classified as #32770 from Windows Info I search in the forums but no answer was usefull. This is a screenshot of the windows And this is the part of the code that's is supposed to control the window WinWait("[CLASS:#32770]", "HP SystemDiags Installer", "") If not WinActive("[CLASS:#32770]", "") then WinActivate("[CLASS:#32770]", "") WinWaitActive("[CLASS:#32770]", "") ControlSend("[CLASS:#32770]", "", 1, "{ENTER}") Any help would be appreciated Link to comment Share on other sites More sharing options...
BrewManNH Posted January 20, 2015 Share Posted January 20, 2015 Your WinWait has the title text in the Window Text parameter. Instead of using the class of the window, mainly because the class used is a very common one, you should use the title text for that parameter. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Shaitan Posted January 20, 2015 Share Posted January 20, 2015 I have the same problem but Windows 8.1 x64 and Windows 10. The AutoIt script simply dont work if there's a CLASS:#32770, it doesn't even launch the application and ignore the control I try to use, even MouseClick. Link to comment Share on other sites More sharing options...
MikahS Posted January 20, 2015 Share Posted January 20, 2015 (edited) Shaitan, Is the application you are trying to automate the same as OP's? Have you tried Brewman's solution? Please post your script so that we can fully understand what you are having troubles with. EDIT: Just as a heads-up, Windows 10 is not something we will break our backs to fix, as it hasn't even been truly released yet! Edited January 20, 2015 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
jdelaney Posted January 20, 2015 Share Posted January 20, 2015 (edited) This will grab the window. ; perform some click to make the popup occur...then (you can create your own loop waiting for the popup): $hEnabledPopup = _WinAPI_GetWindow($hParentWindow,6) WinActivate($hEnabledPopup) ControlFocus($hEnabledPopup,"",6) ControlClick($hEnabledPopup,"",6) WinWaitClose($hEnabledPopup) We have automated each of these OS versions with the above technique (something similar, but with loops): Win7, 8.1, 2k8 server, 2k12 server, and the trial 10 version. Only difference, is we validate control and window states prior to attempting to perform action. If the window is not enabled, the click will not register. Edited: removed ref to control id 1...proper is 6 Edited January 20, 2015 by jdelaney 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 More sharing options...
Moderators SmOke_N Posted January 20, 2015 Moderators Share Posted January 20, 2015 Or: Global $ghWnd = WinWait("[CLASS:#32770]", "HP SystemDiags Installer") If not WinActive($ghWnd) then WinActivate($ghWnd) WinWaitActive($ghWnd) ControlClick($ghWnd, "", "[CLASS:Button; INSTANCE:1]") Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
jdelaney Posted January 20, 2015 Share Posted January 20, 2015 (edited) If it were: Global $ghWnd = WinWait("[CLASS:#32770]") Or Global $ghWnd = WinWait("HP SystemDiags Installer") Edited January 20, 2015 by jdelaney 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 More sharing options...
Shaitan Posted January 20, 2015 Share Posted January 20, 2015 The problems happens in Windows 8.1. I tried to use class and window title, the results are the same: nothing. Whats OP's? Here's the script I wrote. Please note that I had to create batch file to launch the Notepad++ installer, since it wasnt being launched by AutoIt. Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) Run('Notepad\Notepad.cmd') WinWait("[CLASS:#32770]","") If Not WinActive("[CLASS:#32770]","") Then WinActivate("[CLASS:#32770]","") WinWaitActive("[CLASS:#32770]","") ControlSend("[CLASS:#32770]","", 1,"{ENTER}") Shaitan, Is the application you are trying to automate the same as OP's? Have you tried Brewman's solution? Please post your script so that we can fully understand what you are having troubles with. EDIT: Just as a heads-up, Windows 10 is not something we will break our backs to fix, as it hasn't even been truly released yet! Link to comment Share on other sites More sharing options...
BrewManNH Posted January 20, 2015 Share Posted January 20, 2015 Try it with the Title of the window and not the class of it. As I stated earlier, that class is used a LOT on a LOT of different windows so you will have no idea which one is going to get activated or is active because you don't know which one it sees first. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 20, 2015 Moderators Share Posted January 20, 2015 Well, with the OP (original poster), The controlsend() is sending to control id #1, when the button is clearly control id #6, the solution I provided above should work (if you replace the class title with the title of the window itself that Jdelaney provided). Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
jdelaney Posted January 20, 2015 Share Posted January 20, 2015 Ha, only skimmed the output, and went off the instance id...updated my above posts. Yet another way...use both (not really necessary, just providing the example): WinWait("[CLASS:#32770; TITLE:HP SystemDiags Installer]") 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 More sharing options...
Shaitan Posted January 20, 2015 Share Posted January 20, 2015 Try it with the Title of the window and not the class of it. As I stated earlier, that class is used a LOT on a LOT of different windows so you will have no idea which one is going to get activated or is active because you don't know which one it sees first. Thanks but like I said, I tried to use the window's title first and only them I used class althought the exact same problem happened: the scripts runs, activate the correct window but nothing after that, no button is clicked. Link to comment Share on other sites More sharing options...
jdelaney Posted January 20, 2015 Share Posted January 20, 2015 Always provide your code. It's a waste of our time to speculate otherwise. Your issue is probably in trying to click controlid 1, rather than 6. 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 More sharing options...
Shaitan Posted January 20, 2015 Share Posted January 20, 2015 (edited) The code was provided above. Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) Run('Notepad\Notepad.cmd') WinWait("[CLASS:#32770]","") If Not WinActive("[CLASS:#32770]","") Then WinActivate("[CLASS:#32770]","") WinWaitActive("[CLASS:#32770]","") ControlSend("[CLASS:#32770]","", 1,"{ENTER}") Always provide your code. It's a waste of our time to speculate otherwise. Your issue is probably in trying to click controlid 1, rather than 6. Edited January 20, 2015 by Shaitan Link to comment Share on other sites More sharing options...
MikahS Posted January 20, 2015 Share Posted January 20, 2015 (edited) as jdelaney said: ControlSend("[CLASS:#32770]", "", 6, "{ENTER}") Edited January 20, 2015 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Shaitan Posted January 20, 2015 Share Posted January 20, 2015 nothing but the same Link to comment Share on other sites More sharing options...
jdelaney Posted January 20, 2015 Share Posted January 20, 2015 (edited) To be fair, you never provided us the control data you are attempting to interact with...give us that information from the spy tool. In the future, create your own post, rather than piggy backing on another which may or may not have anything to do with your specific issue. Else, you have to provide us the contents of notepad.cmd, so we can reproduce. Edited January 20, 2015 by jdelaney 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 More sharing options...
Shaitan Posted January 20, 2015 Share Posted January 20, 2015 Actually I created a topic a few days ago: '?do=embed' frameborder='0' data-embedContent>> The control I'm trying to interact with is a simple Ok button and what I really don't understand its why the exact same script used to work perfectly in Windows 7 x64. notepad.cmd: start /wait C:\Users\Raphael\Desktop\Appz\Notepad\npp.6.7.4.Installer.exe exit Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 20, 2015 Moderators Share Posted January 20, 2015 Stick to your topic Shaitan. Please don't post here again, they are not relevant. The OP's issue has been addressed specifically. In your post, Post a screen shot of the autoinfo tool over the control you want to click. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
jack71 Posted January 20, 2015 Share Posted January 20, 2015 (edited) I've ran into a few problems with windows like these. Try something like this: expandcollapse popuplocal $HPhandle = WinGetHandle("HP SystemDiags Installer", "Impossibile trovare la partizione HP_TOOLS. Crearla?") ; note: make sure that under the visible text section that is listed. If $HPhandle = "0x00000000" Then $HPhandle = WinGetHandle("[W:386, H:161]", "") EndIf local $done = 0, $cantfindwindow = 0, $failed = 0 While $done = 0 WinActivate($HPhandle) If WinActive($HPhandle) Then ControlFocus($HPhandle, "", 6) local $DidIClick = ControlClick($HPhandle, "", 6) If $DidIClick <> 1 Then ControlFocus($HPhandle, "", 6) ControlSend($HPhandle, "", 6, "{ENTER}") Sleep(1000) If WinExists($HPhandle, "") or WinExists("[W:386, H:161]", "") Then $failed += 1 If $failed = 5 Then MouseClick("Left", "X", "Y") ; Get Mouse Position X, Y from au3info ExitLoop EndIf Else $done = 1 EndIf Else $done = 1 EndIf Else Sleep(500) $cantfindwindow += 1 If $cantfindwindow = 10 Then MouseClick("Left", "X", "Y") ; Get Mouse Position X, Y from au3info ExitLoop EndIf EndIf WEnd Edited January 20, 2015 by jack71 Link to comment Share on other sites More sharing options...
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