Rishav Posted April 3, 2009 Share Posted April 3, 2009 (edited) Hi folksI have a problem with listboxes.I have a listbox which shows me the sheet names form a selected excel.It will show the last element selected by default.the code I am using is;ControlFocus("myapp", "Sheet Details:", $hwnd) _GUICtrlListBox_SelectString($hwnd, "Sheet4", -1) send("{SPACE}")Problem is that the checkbox and the selection aren't tied to each other. SO I have to send an extra spacebar press to check the item. Now if I wanted to check Sheet4 item in the listbox and if its already checked, it will simply uncheck it (as spacebar is still pressed)I need a way of finding if the item at a certain index is checked or not. Or if possible, set check or uncheck on it irrespective of its current check status.please note that the control id is for the entire list box and I can't have the controls for each element in the listbox.any ideas?regardsRishav Edited April 13, 2009 by Rishav Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 3, 2009 Moderators Share Posted April 3, 2009 Most people here use Excel.au3 file in the Example scripts to manipulate data in excel. 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...
Rishav Posted April 3, 2009 Author Share Posted April 3, 2009 Can't help that. T_T i am trying to automate my company's product. Link to comment Share on other sites More sharing options...
Rishav Posted April 6, 2009 Author Share Posted April 6, 2009 (edited) so any ideas?..... Edited April 6, 2009 by Rishav Link to comment Share on other sites More sharing options...
Rishav Posted April 13, 2009 Author Share Posted April 13, 2009 bumping it again. Any ideas anyone? Link to comment Share on other sites More sharing options...
reikenberg Posted April 23, 2009 Share Posted April 23, 2009 (edited) Try a {TAB} instead of {SPACE}, worked for me. added: ups, will not slove your checkbox problem Edited April 23, 2009 by reikenberg Link to comment Share on other sites More sharing options...
vimala Posted October 29, 2009 Share Posted October 29, 2009 Hi folks I have a problem with listboxes. I have a listbox which shows me the sheet names form a selected excel.It will show the last element selected by default. the code I am using is; ControlFocus("myapp", "Sheet Details:", $hwnd) _GUICtrlListBox_SelectString($hwnd, "Sheet4", -1) send("{SPACE}") Problem is that the checkbox and the selection aren't tied to each other. SO I have to send an extra spacebar press to check the item. Now if I wanted to check Sheet4 item in the listbox and if its already checked, it will simply uncheck it (as spacebar is still pressed) I need a way of finding if the item at a certain index is checked or not. Or if possible, set check or uncheck on it irrespective of its current check status. please note that the control id is for the entire list box and I can't have the controls for each element in the listbox. any ideas? regards Rishav hello Rishav Have u used these commands which iam giving below ? It will select both the checkbox and listitems.look into the script i have used _GUICtrlListBox_ClickItem ($hwnd,$ListboxIndex,"",False,2)(no 2) at the last of this function and why do u need for each element.?it will click twice one for item and second click for checkbox. $hwnd=ControlGetHandle("title","text","ControlID") $ListboxIndex = _GUICtrlListBox_SelectString($hWnd, "Sheet4") _GUICtrlListBox_ClickItem ($hwnd,$ListboxIndex,"",False,2) Link to comment Share on other sites More sharing options...
vimala Posted October 29, 2009 Share Posted October 29, 2009 hello Rishav Have u used these commands which iam giving below ? It will select both the checkbox and listitems.look into the script i have used _GUICtrlListBox_ClickItem ($hwnd,$ListboxIndex,"",False,2)(no 2) at the last of this function and why do u need controlid for each element.?it will click twice one for item and second click for checkbox. $hwnd=ControlGetHandle("title","text","ControlID") $ListboxIndex = _GUICtrlListBox_SelectString($hWnd, "Sheet4") _GUICtrlListBox_ClickItem ($hwnd,$ListboxIndex,"",False,2) 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