Jump to content
Yijie

SelectString (or FindString and SetCurrentSelection) in ControlCommand to select a string in ComboBox out of GUI

Recommended Posts

Yijie

I fail to use SelectString (or FindString and SetCurrentSelection) in ControlCommand to select a string in a ComboBox. 

Below are several versions of my codes: 

ControlCommand ("Merge Channels", "", 1, "SelectString", $sD12ID)
Local $sOccrefD1 = ControlCommand ("Merge Channels", "", "ComboBox1", "FindString", $sD12ID);find occurrence ref for D1/D2
ControlCommand ("Merge Channels", "", "ComboBox1", "SetCurrentSelection", $sOccrefD1) ;select the found occurrence ref
$index = ControlCommand("Merge Channels", "", 1, "FindString", $sD12ID)
ControlSend("Merge Channels", "", 1, "Select", $index)

So I have tried changing among the possible options I know. I have also tried changing the ControlID. I have a for loop outside of this and it selects the first option in the ComboBox in the first iteration and ignores the selecting bit afterwards. 

I saw some solutions including using _GUICtrlComboBox_SelectString but to use this you need to create your own ComboBox. I need to select one from an already existing one in another software so I don't think it helps. 

I also tried the example in this page. It only ran the Win+r without selecting the file (I have changed the file name to one that I have on my computer. https://www.autoitscript.com/forum/topic/129841-selecting-a-exact-string-from-dropdown/

Could anyone help me please? 

Share this post


Link to post
Share on other sites
careca

Here's the really weird part about this, i compiled a combobox example from the help file, and then tried to interact with it, but only the first line works, the dropdown works, but nothing else, the second line just gives an error, tried the findstring too, same thing.

ControlCommand("ComboBoxEx Get Combo Control", "", 10000, "ShowDropDown")
Sleep(1000)
$res = ControlCommand("ComboBoxEx Get Combo Control", "", 10000, "SelectString", '093 : Random string')
ConsoleWrite($res&' - '& @error&@CRLF)

Maybe there's a bug? I dont see any reason why it shouldn't work.

New AutoIt3.exe


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×