I've just stumbled upon AHK when looking for a way to save me some mouse pointing and clicking. Having an electronic dictionary is great time saver by itself, but I'd like to take it a step further. I'm looking for following functionality:
I select some text, then hit a hotkey which launches a script which copies selected text, pastes it into dictionary and searches it.
I have found AHK and looked into its extensive scripting options and it seems like it is the tool I'm looking for, but since I just started familiarizing myself with it, I'm a bit lost and I'd like to ask for help.
I've figured the macro should do the following:
- Copy the selected text into clipboard. I assume "pressing" ctrl+c would do the trick and I have figured out how to do it. But I am curious, is there a way to save it to clipboard directly and is better to do it that way?
- Activate the dictionary window. I have figured out this one as well.
- Focus the search textbox. I have no idea how to do that. Examples I've seen work with Notepad, which has focus on the typing area when it gets activated, which is not the case in here. I'm under impression that interacting with contents of other windows is possible somehow, but I haven't figured it out yet. The scripting help is huge and I haven't familiarized with various options I have yet. Which methods should I look up? I have a picture of the dictionary window and the search textbox is marked by "1" on it.
- Paste the text from clipboard over any text which may be present. "Pressing" ctrl+a and ctrl+v should work.
- Running the search. Either hitting enter or clicking search button works. I am considering "pressing" enter because it seems much easier than pressing the button, but the reason behind that is that I have no idea how to approach the button route. For completness' sake I have marked the button as "2" on the picture.
Any help would be much appreciated. I'm looking for either pointers so I can write the script myself or a script I could dissect and learn from it.
Thanks in advance!