views:

204

answers:

1

Hi,

I have a piece of closed-source third party windows software which consists of only one window and is minimized almost all the time. I'd like to be able to change the selected item of a combobox in that window via a system-wide hotkey. If possible, I'd like to keep the third party app minimized in the process.

I guess this should be easy to do with Autoit or Autohotkey, but I have never used either of these tools before.

Which tool would be better suited for the job? Does anyone have any pointers on where to start? For example a link to a tutorial showing a similar scenario.

+3  A: 

I wrote you a small example of how you could do this. For some reason I used a GUI I build in code. I will see about putting another example in that manipulates a GUI not created in the script.

AutoIt Code...

HotKeySet("{ESC}", "_Exit")
HotKeySet("^{z}", "_SetItem1")
HotKeySet("^{x}", "_SetItem2")
HotKeySet("^{c}", "_SetItem3")

;Set up a quick GUI for us to play with.
$gui = GUICreate("Test GUI", 150, 150, -1, -1)
GUICtrlCreateCombo("", 10, 50, 130)
GUICtrlSetData(-1, "Item1|Item2|Item3", "Item1")
GUISetState(@SW_SHOW)

While 1
    ; Just to keep things running
WEnd

Func _SetItem1()
    ControlSend ( "Test GUI", "", "ComboBox1", "{up}{up}{up}" )
EndFunc   ;==>_SetItem1


Func _SetItem2()
    ControlSend ( "Test GUI", "", "ComboBox1", "{up}{up}{up}{down}" )
EndFunc   ;==>_SetItem1


Func _SetItem3()
    ControlSend ( "Test GUI", "", "ComboBox1", "{up}{up}{up}{down}{down}" )
EndFunc   ;==>_SetItem1

Func _Exit()
    Exit
EndFunc   ;==>_Exit
Copas
Thank you so much! It should be very easy to change this into the script i need.
Adrian Grigore