Shibuya Posted November 23, 2005 Share Posted November 23, 2005 (edited) need help with a function tried it out but somehow it stopped midway expandcollapse popup;================================================================================================== ;Function Name : _ControlComboBox() ; ;Description : Sends a command to a ComboBox control ; ;Parameter(s) : $cbTitle - The title of the window to access ; $cbControlID - The control to interact with ; $Switch - The command to send to the control : ; ;Return(s) : - "GetItemCount" - Returns the number of ComboBox items ;($Switch dependent) - "GetItemList" - Returns a array containing the list of items in the control ; - Returns 0 if invalid switch ;================================================================================================== Func _ControlComboBox($cbTitle, $cbControlID, $Switch) If $Switch = "" Then Return 0 Local $cbListItems[101] Local $MaxCount = 0 ControlSend($cbTitle, "", $cbControlID, "{HOME}") $cbListItems[1] = ControlCommand($cbTitle, "", $cbControlID, "GetCurrentSelection", "");get the first item $count = 2 While 1 ControlSend($cbTitle, "", $cbControlID, "{HOME}") ControlSend($cbTitle, "", $cbControlID, "{DOWN " & $count - 1 & "}") $cbListItems[$count] = ControlCommand($cbTitle, "", $cbControlID, "GetCurrentSelection", "");get the next item If $cbListItems[$count] = $cbListItems1][$count - 1] Then $cbListItems[$count] = "" $MaxCount = $count - 1 $cbListItems[0] = $MaxCount; number of items ExitLoop EndIf $count = $count +1 WEnd ReDim $cbListItems[$MaxCount + 1] If $Switch = "GetItemCount" Then Return $MaxCount ElseIf $Switch = "GetItemList" Then Return $cbListItems Else Return 0 EndIf EndFunc anyone care to help me test this out to see what's wrong? EDIT : changed from using a 2-dim array to a 1-dim EDIT 2 : figured out the problem and fixed EDIT 3 : any idea how to make this cleaner? I realised that if this function is used with a combobox which can initialise a pop-up, could fail the whole script Edited November 23, 2005 by Shibuya The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!" Link to comment Share on other sites More sharing options...
Shibuya Posted November 25, 2005 Author Share Posted November 25, 2005 (edited) I digged the forums and found these:ListBoxGetCount()ListBox Madnessand noticed that the user32.dll - SendMessage command can actually peek into a ListBoxany idea if it can be done the same for a ComboBox?I've looked into the MSDN Library over it and have absolutely no idea to start lookingAnyone who's familiar with this please help? Edited November 25, 2005 by Shibuya The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!" Link to comment Share on other sites More sharing options...
GaryFrost Posted November 25, 2005 Share Posted November 25, 2005 You might want to look at this thread http://www.autoitscript.com/forum/index.ph...ndpost&p=109731if you decide to use the whole include file you'll need the beta, see my signature for link to it. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Shibuya Posted November 25, 2005 Author Share Posted November 25, 2005 thanks gafrost!!! found the _GUICtrlComboGetCount() u mind poit out to me which one could get the list of the items? if i guessed correctly, i probably have to do a loop for _GUICtrlComboGetLBText() to get the list, right? The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!" Link to comment Share on other sites More sharing options...
GaryFrost Posted November 25, 2005 Share Posted November 25, 2005 thanks gafrost!!!found the _GUICtrlComboGetCount()u mind poit out to me which one could get the list of the items?if i guessed correctly, i probably have to do a loop for _GUICtrlComboGetLBText() to get the list, right? You got it. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Shibuya Posted November 25, 2005 Author Share Posted November 25, 2005 Great!!! Thanks again!!! The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!" Link to comment Share on other sites More sharing options...
Shibuya Posted November 25, 2005 Author Share Posted November 25, 2005 damn I need help again #include ".\Includes\GuiCombo.au3" WinActivate("Display Properties") WinWaitActive("Display Properties") $hnd = ControlGetHandle("Display Properties", "", "ComboBox1") $var = _GUICtrlComboGetCurSel($hnd) MsgBox(0, "", $hnd) MsgBox(0, "", $var) can anyone tell me what's wrong with the above code? I've tried it on the Display Properties window, using the Themes combobox to test it I used the beta, no error codes on my SciTe editor other than the undefined IsHWnd(), which I think is because I haven't update my SciTe The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!" Link to comment Share on other sites More sharing options...
GaryFrost Posted November 25, 2005 Share Posted November 25, 2005 (edited) works for me, make sure your running in beta, either Alt+F5 or Tools, run betaalso you can add MsgBox(0,"Version",@AutoItVersion)http://www.autoitscript.com/fileman/users/public/gafrost/combo1.JPGhttp://www.autoitscript.com/fileman/users/public/gafrost/combo2.JPG Edited November 25, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Shibuya Posted November 28, 2005 Author Share Posted November 28, 2005 sorry for the late reply the UDF is working, just that I've used the wrong command I should've used _GUICtrlGetLBText() my bad The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!" 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