Issues with Click method in COM

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
AllUrBaseRBelong2Us
Posts: 35
Joined: 09 Nov 2015, 11:15

Issues with Click method in COM

18 Nov 2015, 00:27

What I want to do is pretty simple -
1.Open Google
2.Enter search text
3.Smash that 'Google Search' button

Problem:
Click method doesn't seem to work. Code follows:

Code: Select all

SetBatchLines, -1
#NoEnv
#SingleInstance force

Load(wb)
{
    while wb.busy
		sleep, 100
}

wb := ComObjCreate("InternetExplorer.Application") 
wb.Visible := True
wb.Navigate("Google.com")
Load(wb)
wb.Document.All.q.Value := "sample text"
wb.Document.All.btnK.click() ;<---This part simply doesn't work!
Load(wb)
Any help will be greatly appreciated. Thanks in advance!
User avatar
Soft
Posts: 174
Joined: 07 Jan 2015, 13:18
Location: Seoul
Contact:

Re: Issues with Click method in COM

18 Nov 2015, 02:55

Alternatively, I guess you can try controlfocus and controlsend since wb.hwnd stores the explorer's hwnd.
AutoHotkey & AutoHotkey_H v1.1.22.07
User avatar
tank
Posts: 3122
Joined: 28 Sep 2013, 22:15
Location: CarrolltonTX
Contact:

Re: Issues with Click method in COM

18 Nov 2015, 07:59

google is obstinante
wb.Document.All.q.form.submit()
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter
AllUrBaseRBelong2Us
Posts: 35
Joined: 09 Nov 2015, 11:15

Re: Issues with Click method in COM

18 Nov 2015, 23:10

tank wrote:google is obstinante
wb.Document.All.q.form.submit()
Thanks @tank - it works perfectly. Just one more question: Can I use this field.form.submit() to trigger the submit method on any webpage without messing around with buttons? Thanks in advance!
User avatar
tank
Posts: 3122
Joined: 28 Sep 2013, 22:15
Location: CarrolltonTX
Contact:

Re: Issues with Click method in COM

19 Nov 2015, 11:40

Some but not all. as with anything it will require experimentation
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], Lamron750, terraformars and 274 guests