Help With IE COM Input box that has autocomplete results

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
grimboto
Posts: 53
Joined: 09 Jul 2014, 19:20

Help With IE COM Input box that has autocomplete results

Post by grimboto » 10 Aug 2019, 03:13

Im trying to automate a website to look up address. it has a search box that when you type in it it lists suggested address in a list under the searchbox.
im trying to retrieve the values that it suggests.

the below code navigates to the website and sets a value in the search box but no suggestions appear


WB := ComObjCreate("InternetExplorer.Application")
WB.Visible := true
WB.Navigate("https://mapshare.vic.gov.au/MapShareVic/index.html?viewer=MapShareVic.PublicSite")

msgbox wait until site is loaded then push ok

buttons := WB.document.getElementsByTagName("button")

;Click agree on the dialog that appears
loop % buttons.length
{
if(buttons[a_index-1].innerHTML = "Agree"){

buttons[a_index-1].click()
break
}
}

WB.document.getElementsByName("search")[0].value := "10 glenfern road"



is there a way to get them to appear after i have set the value?

any help would be appreciated

the results i want to appear
results.png
results.png (484.43 KiB) Viewed 533 times
what is currently happening
No results.png
No results.png (785.64 KiB) Viewed 533 times

User avatar
Sir Teddy the First
Posts: 94
Joined: 05 Aug 2019, 12:31
Contact:

Re: Help With IE COM Input box that has autocomplete results

Post by Sir Teddy the First » 10 Aug 2019, 03:28

Hi,
what you have to do:

You select the searchbox via ".Select()" and then use ControlSend to send text.

Why you have to do this
The website is waiting for physical keystrokes to be sent, not just a changed value.

The Code would be something like this:

Code: Select all

WB.document.getElementsByName("search")[0].Select()

window := WB.hwnd	; here you retrieve the window handle for your COM-Object
ControlSend,Internet Explorer_Server1, %YOURTEXT%, ahk_id %window%
This should work.
You might have to put a sleep inbetween the first two lines, depending on how fast the website reacts.
:eh: :think:

Post Reply

Return to “Ask for Help (v1)”