0
votes

I used MS Excel sheet for tests but it failed to work. My script is this:

F1::
ControlGetText, OutputVar, Edit1, ahk_class XLMAIN
Return
F2::
Send %OutputVar%
Return

So when I press hotkey F1, the script should retrieve the text of edit box and when I press hotkey F2 it should send that text, but it is doing nothing on pressing these keys.

As you can see in this snapshot:

screenshot

(All the control IDs are only for the purpose of testing)

1

1 Answers

0
votes

You're using it correctly.

There are lots of controls that won't let you retrieve the text directly.

The problem in this case is that Excel stopped respecting its WinAPI origins and doesn't store the text in the control. Connect to the running Excel application and use its automation interface:

F1::address := ComObjActive("Excel.Application").ActiveCell.Address(0,0)
F2::send %address%

For SysTreeView32 controls you can try the low level SendMessage method