AHK, Excel and the Query problem(?)

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
DadRabbit
Posts: 6
Joined: 17 Jun 2014, 08:24

AHK, Excel and the Query problem(?)

Post by DadRabbit » 23 Nov 2020, 20:32

I'm not quite sure which is the proper forum for this, so if it doesn't fit here please let me know. I'm working with Excel 365 using AHK (1.1.33.02), windows 10. Here's my situation:

I have an open active Excel spreadsheet; using AHK, I want to access a remote website (the URL is in a cell in the SS), download a mess of data into the SS and then clean up the data (format, etc.) before saving the SS – all under AHK control. Everything starts out sweet - using controlclick I can fire the button in the Excel ribbon to start the process of accessing the remote site and it works just fine … but then things begin to go south. A data entry window opens (to place the URL into), and there is an “OK” button in that window which needs to be clicked after the URL is pasted in to initiate the web call but said window and its associated controls (of which the above-mentioned “OK” is one) are no longer accessible by the controlclick method. Fortunately, this new window is "birthed" with the focus already on the field that the URL goes into so a simple "^v" puts the URL in the correct place. But I can't get to the "OK" button. Dead in the water. WindowSpy offers no usable information on the data entry window nor its controls/buttons/etc. As you know, controlclick requires some sort of window and/or control identification – but I am unable to access such info.

Much investigation (not to mention gnashing of teeth and rending of garments) leads me to believe that the action of clicking the “get data from web” button on the Excel ribbon apparently opens an Excel “Query” which renders the data entry window essentially invisible to WindowSpy. Is this possible??

Interestingly, the old faithful “MouseClick, left, X, Y” procedure seems to work most of the time, but I MUCH prefer the controlclick approach; less timing issues, window sizing, placement, etc.

I am out of ideas … would this be a situation for a COM object approach? Any ideas/suggestions will be greatly appreciated

ahk7
Posts: 575
Joined: 06 Nov 2013, 16:35

Re: AHK, Excel and the Query problem(?)

Post by ahk7 » 12 Dec 2020, 08:56

I know next to nothing about COM and what have you, but have you considered:

* The ImageSearch + Click command; or use FindText https://www.autohotkey.com/boards/viewtopic.php?t=17834
* Send {TAB x}{enter} to get to the [OK] button

Post Reply

Return to “Ask for Help (v1)”