gigabyte Posted June 16, 2011 Share Posted June 16, 2011 Following is the list of items in a dropdown 1. 'TAB Processor (TAB QWERTYGP Compound) - Qwert00' 2. 'TDD Processor (TDD QWERTYGP Compound) - Qwert00' 3. 'TPA Processor (TPA QWERTYGP Compound) - Qwert00' I am using the following code to select a particular string from dropdown. ControlCommand("Test Form", "", $hcombo, "ShowDropDown") ControlSend("Test Form", "", $hcombo, "select", 'TPA Processor (TPA QWERTYGP Compound) - Qwert00') But instead of selecting 'TPA Processor (TPA QWERTYGP Compound) - Qwert00' string it selects 'TAB Processor (TAB QWERTYGP Compound) - Qwert00' PLease help how I can force it to select a particular string instead of it matching the first character. Link to comment Share on other sites More sharing options...
jchd Posted June 16, 2011 Share Posted June 16, 2011 Try using this: ControlCommand("Test Form", "", $hcombo, "ShowDropDown") ControlCommand("Test Form", "", $hcombo, "SelectString", 'TPA Processor (TPA QWERTYGP Compound) - Qwert00') This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
gigabyte Posted June 16, 2011 Author Share Posted June 16, 2011 (edited) Try using this: ControlCommand("Test Form", "", $hcombo, "ShowDropDown") ControlCommand("Test Form", "", $hcombo, "SelectString", 'TPA Processor (TPA QWERTYGP Compound) - Qwert00') Tried this way as well but it wont even select any thing. Any thing I am missing here. Following is the full code I am trying #Include <GuiComboBox.au3> #include <Constants.au3> local $hcombo = "[NAME:ctlMsgQueueCombo]" ;Start test executable Run("Z:\test\Groups\bin\Debug\Test.exe") Global $hWHandle = WinWaitActive("Test Form", "", 2) sleep(8000) controlFocus("", "", "[NAME:ctlQueSelector]") controlsend("", "", "[NAME:ctlQueSelector]", '2') ControlCommand("Test Form", "", $hcombo, "ShowDropDown") ControlCommand("Test Form", "", $hcombo, "SelectString", 'TPA Processor (TPA QWERTYGP Compound) - Qwert00') IS there any thing to do with string = "TPA Processor (TPA QWERTYGP Compound) - Qwert00" as it is containing (spaces, (,), -, numbers). Edited June 16, 2011 by gigabyte Link to comment Share on other sites More sharing options...
jchd Posted June 16, 2011 Share Posted June 16, 2011 It shouldn't matter. Try using just the "TPA" part. Do you have any error return? This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
gigabyte Posted June 16, 2011 Author Share Posted June 16, 2011 (edited) It shouldn't matter. Try using just the "TPA" part.Do you have any error return?but its a long list and many start with TPA e.gFollowing is the list of items in a dropdown1. 'TAB Processor (TAB QWERTYGP Compound) - Qwert00'2. 'TDD Processor (TDD QWERTYGP Compound) - Qwert00'3. 'TPA Processor (TPA QWERTYGP Compound) - Qwert00'4. 'TPA Processor (TPA QWERTYAD Compound) - Qwert01'5. 'TPA Processor (TPA QWERTYGD Compound) - Qwert02'6. 'TAB Processor (TAB QWERTYAD Compound) - Qwert01'in this case it will always selects the first TPA one...Why it is not matching the whole string. as these values varies according to company. and I need to select a particular one."SelectString" is not working. it selects using the "Select".No error return Edited June 16, 2011 by gigabyte Link to comment Share on other sites More sharing options...
jchd Posted June 16, 2011 Share Posted June 16, 2011 Someone else will have to take this over me, I'm clueless and not familiar enough with related issues to guide you efficiently. Sorry for that. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
gigabyte Posted June 16, 2011 Author Share Posted June 16, 2011 Someone else will have to take this over me, I'm clueless and not familiar enough with related issues to guide you efficiently.Sorry for that. ...Desperalty waiting for someone to guide me over this...As this has been now 2 days and I even tried with _GUICtrlComboBox_FindString, _GUICtrlComboBox_SelectString, _GUICtrlComboBox_SetCurSel but nothing seems to work... Link to comment Share on other sites More sharing options...
jchd Posted June 16, 2011 Share Posted June 16, 2011 Does and/or bring any help? This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Joon Posted June 16, 2011 Share Posted June 16, 2011 I don't have a problem using ControlCommand function with 'FindString' command. Here is an example. #include <GUIConstantsEx.au3> $text = 'TAB Processor (TAB QWERTYGP Compound) - Qwert00' $text &= '|' & 'TDD Processor (TDD QWERTYGP Compound) - Qwert00' $text &= '|' & 'TPA Processor (TPA QWERTYGP Compound) - Qwert00' $text &= '|' & 'TPA Processor (TPA QWERTYAD Compound) - Qwert01' $text &= '|' & 'TPA Processor (TPA QWERTYGD Compound) - Qwert02' $text &= '|' & 'TAB Processor (TAB QWERTYAD Compound) - Qwert01' Example() Func Example() Local $msg GUICreate("My GUI combo") ; will create a dialog box that when displayed is centered GUICtrlCreateCombo("", 10, 10,300) ; create first item GUICtrlSetData(-1,$text) $btnFind = GUICtrlCreateButton("Find String",10,50) GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $btnFind Then $index = ControlCommand("My GUI combo","Find String","ComboBox1","FindString",'TPA Processor (TPA QWERTYAD Compound) - Qwert01') ControlCommand("My GUI combo","Find String","ComboBox1","SetCurrentSelection",$index) EndIf If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc ;==>Example guner7 1 Link to comment Share on other sites More sharing options...
gigabyte Posted June 17, 2011 Author Share Posted June 17, 2011 I don't have a problem using ControlCommand function with 'FindString' command. Here is an example. #include <GUIConstantsEx.au3> $text = 'TAB Processor (TAB QWERTYGP Compound) - Qwert00' $text &= '|' & 'TDD Processor (TDD QWERTYGP Compound) - Qwert00' $text &= '|' & 'TPA Processor (TPA QWERTYGP Compound) - Qwert00' $text &= '|' & 'TPA Processor (TPA QWERTYAD Compound) - Qwert01' $text &= '|' & 'TPA Processor (TPA QWERTYGD Compound) - Qwert02' $text &= '|' & 'TAB Processor (TAB QWERTYAD Compound) - Qwert01' Example() Func Example() Local $msg GUICreate("My GUI combo") ; will create a dialog box that when displayed is centered GUICtrlCreateCombo("", 10, 10,300) ; create first item GUICtrlSetData(-1,$text) $btnFind = GUICtrlCreateButton("Find String",10,50) GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $btnFind Then $index = ControlCommand("My GUI combo","Find String","ComboBox1","FindString",'TPA Processor (TPA QWERTYAD Compound) - Qwert01') ControlCommand("My GUI combo","Find String","ComboBox1","SetCurrentSelection",$index) EndIf If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc ;==>Example I am confused, Please clear my understanding. Why do we have to create a GUIcombobox and populate it with values. What I want is to select value from an existing open form. Is it possible with this. because in the example you are creating a new combo and then populating it with values. and then using the guicombo to find a string. please guide. Link to comment Share on other sites More sharing options...
gigabyte Posted June 17, 2011 Author Share Posted June 17, 2011 Does and/or bring any help?Yes, But couldn't make it work Link to comment Share on other sites More sharing options...
Joon Posted June 17, 2011 Share Posted June 17, 2011 I am confused, Please clear my understanding. Why do we have to create a GUIcombobox and populate it with values. What I want is to select value from an existing open form. Is it possible with this. because in the example you are creating a new combo and then populating it with values. and then using the guicombo to find a string. please guide.I don't have same form windows as you have. I need something to test with... This shouldn't be any differenct than yours. I'm just testing FindString is working or not. And, it seems working fine to me. Link to comment Share on other sites More sharing options...
gigabyte Posted June 17, 2011 Author Share Posted June 17, 2011 (edited) I don't have same form windows as you have. I need something to test with... This shouldn't be any differenct than yours. I'm just testing FindString is working or not. And, it seems working fine to me.Looks like a bug in autoit, as it is unable to handle a specific string instead just matches first characters and if they match just selects it, if its a external gui form. Edited June 17, 2011 by gigabyte Link to comment Share on other sites More sharing options...
Joon Posted June 17, 2011 Share Posted June 17, 2011 (edited) Looks like a bug in autoit, as it is unable to handle a specific string instead just matches first characters and if they match just selects it, if its a external gui form. You are jumping to the conclusion too quickly. So, here is test code with external GUI. Send("#r") Sleep(1000) $index = ControlCommand("Run", "Type", "ComboBox1", "FindString", 'C:\Windows\SysWOW64\cmd.exe') ControlCommand("Run", "Type", "ComboBox1", "SetCurrentSelection", $index) My search string 'C:\Windows\SysWOW64\cmd.exe' was way down in the list. Edited June 17, 2011 by Joon Link to comment Share on other sites More sharing options...
gigabyte Posted June 17, 2011 Author Share Posted June 17, 2011 (edited) You are jumping to the conclusion too quickly. So, here is test code with external GUI. Send("#r") Sleep(1000) $index = ControlCommand("Run", "Type", "ComboBox1", "FindString", 'C:\Windows\SysWOW64\cmd.exe') ControlCommand("Run", "Type", "ComboBox1", "SetCurrentSelection", $index) My search string 'C:\Windows\SysWOW64\cmd.exe' was way down in the list. Can you please tell, you are trying this code on which ver of windows. I am using Windows 7. PLz also guide in your code ControlCommand("Run", "Type", "ComboBox1", "SetCurrentSelection", $index) what is this "Type" refering to. Edited June 17, 2011 by gigabyte Link to comment Share on other sites More sharing options...
Joon Posted June 17, 2011 Share Posted June 17, 2011 Can you please tell, you are trying this code on which ver of windows. I am using Windows 7 and doing exactly same.Windows 7 Enterprise x64 Link to comment Share on other sites More sharing options...
gigabyte Posted June 17, 2011 Author Share Posted June 17, 2011 Windows 7 Enterprise x64So sorry for jumping too quickly, but really feels like banging my head on wall.. . Link to comment Share on other sites More sharing options...
gigabyte Posted June 17, 2011 Author Share Posted June 17, 2011 Windows 7 Enterprise x64Just found out in the following codeControlCommand($title,"Find String",$hcombo,"SetCurrentSelection",$index)"SetCurrentSelection" would not come up while typing instead just Select is available. Am I missing some library or any missing tool. Link to comment Share on other sites More sharing options...
gigabyte Posted June 20, 2011 Author Share Posted June 20, 2011 (edited) I don't have same form windows as you have. I need something to test with... This shouldn't be any differenct than yours. I'm just testing FindString is working or not. And, it seems working fine to me.Yes I tested your piece of code and yes it works fine when you create your own form and populate it with values. Problem is coming when you have an existing windows application form with already populated values in it. and then you try to find a string, it wont work. Not possible for me to send that form, Can you please test this with any of your existing application, If possible. Would be highly grateful. the following code works but always selects 5th item in list from a list of 10 items$index = ControlCommand($title,"",$hcombo,"FindString",'TPA Processor (TPA QWERTYAD Compound) - Qwert01')ControlSend($title, "", $hcombo, "select", $index) Edited June 20, 2011 by gigabyte 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