Created
October 8, 2016 21:02
-
-
Save isofew/f125752ea6ffd573f1361c9937277f53 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; get/set GUI combobox/listbox in command line | |
Global $argc = $CmdLine[0] | |
If $argc < 1 Then | |
Usage() | |
EndIf | |
Switch $CmdLine[1] Then | |
Case "get" | |
If $argc < 3 Then | |
Usage() | |
EndIf | |
ConsoleWrite(Get($CmdLine[2], $CmdLine[3])) | |
Case "set" | |
If $argc < 4 Then | |
Usage() | |
EndIf | |
Set($CmdLine[2], $CmdLine[3], $CmdLine[4]) | |
Case Else | |
Usage() | |
EndSwitch | |
Func Usage() | |
ConsoleWrite("Usage: windows [get|set] window control [value]") | |
Exit(1) | |
EndFunc | |
Func Get($window, $control) | |
Return ControlCommand($window, "", $control, "GetCurrentSelection") | |
EndFunc | |
Func Set($window, $control, $value) | |
Local $ref = ControlCommand($window, "", $control, "FindString", $value) | |
ControlCommand($window, "", $control, "SetCurrentSelection", $ref) | |
ControlClick($window, "", $control) | |
ControlSend($window, "", $control, "{ENTER}") | |
EndFunc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment