hennes000 Posted October 28, 2014 Share Posted October 28, 2014 Hi, I'm trying to get autoit to choose a specific option from this titleless listbox. ie. I want the macro to select the CHEMISTRY2 option by pressing the up and down keys. Possibly by, macro checking option currently highlighted. if it is equal to CHEMISTRY2, press enter if not press down repeat However I'm unsure of the coding as I'm new to autoit. All help will be much appreciated. Thank you in advance. Link to comment Share on other sites More sharing options...
jdelaney Posted October 28, 2014 Share Posted October 28, 2014 (edited) Were you focused on the control, or the window. If window, get the output again, for the control. #include <WinAPI.au3> $hWin = WinGetHandle("The parent window title that opens that 'enabled popup'") $hPopup = _WinAPI_GetWindow($hWin,6) $hControl_List = ControlGetHandle($hPopup,"","you need to provide more info to get the control") $hControl_Button = ControlGetHandle($hPopup,"","[TEXT:&OK]") WinActivate($hPopup) ControlFocus($hPopup,"",$hControl_List) ControlCommand($hPopup,"",$hControl_List,"SelectString", 'whatever you want to select in list') ControlFocus($hPopup,"",$hControl_Button) ControlClick($hPopup,"",$hControl_Button) Edited October 28, 2014 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...
hennes000 Posted October 29, 2014 Author Share Posted October 29, 2014 (edited) Hi, thank you for your prompt reply I was focused on the window this is the info I get when focused on the control Edited October 29, 2014 by hennes000 Link to comment Share on other sites More sharing options...
Solution jdelaney Posted October 29, 2014 Solution Share Posted October 29, 2014 ; plug in your parent window, and the value you want to set, and good to go #include <WinAPI.au3> $hWin = WinGetHandle("The parent window title that opens that 'enabled popup'") $hPopup = _WinAPI_GetWindow($hWin,6) $hControl_List = ControlGetHandle($hPopup,"",1011) $hControl_Button = ControlGetHandle($hPopup,"","[TEXT:&OK]") WinActivate($hPopup) ControlFocus($hPopup,"",$hControl_List) ControlCommand($hPopup,"",$hControl_List,"SelectString", 'whatever you want to select in list') ControlFocus($hPopup,"",$hControl_Button) ControlClick($hPopup,"",$hControl_Button) hennes000 1 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...
hennes000 Posted October 30, 2014 Author Share Posted October 30, 2014 Thank you so much. 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