Click on a button

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
manbat42
Posts: 22
Joined: 04 Nov 2017, 11:25

Click on a button

08 Nov 2017, 11:14

Hi Guys

My english is very poor, so apologise for that.

I'm trying to write a script to fill a text box and, after thar, to click on a button

I can fill the text Box with this code:

#####################################################################################
Pwb := ComObjCreate( "InternetExplorer.Application" ) ;Creates the ComObj
Pwb.Navigate("http://sipe.jtcredtributarios.ritta.loc ... inicio.htm")
Pwb.Visible := True ; Shows the IE app

While ( Pwb.Busy || Pwb.ReadyState != 4 ) ; Waits for the webpage to finish loading
Sleep 10
WinWait, Sistema de Penhoras Electrónicas
WinMaximize,
Sleep 100
valor := ""
Objecto :=Pwb.document.getElementById("numeroPedidoPenhora")
Objecto.value := pedido

(Here I need to click on "Pesquisar")

####################################################################################

I tryed to reach the "Pesquisa" button, but I did'nt achieve to find it.

I Adde three files to show what I need.
I'm working on an intranet.

I don't know if I need to explain more my problem.

Thanks, in advance
HIAC
Posts: 111
Joined: 11 Oct 2017, 17:59
Location: Republic of Serbia

Re: Click on a button

08 Nov 2017, 19:04

I've tried opening that webpage but unsuccessfully..

I notice few mistakes in your script;

Code: Select all

While pwb.busy or pwb.ReadyState !=4 ; Waits for the webpage to finish loading
	Sleep 10
There must be space before Sleep, so it determines which codes will execute while "while-loop" is active

Code: Select all

WinMaximize,
It cannot be left blank, you must specify the windows title

You need to get the button element ID or name, this is an example for ID:

Code: Select all

pwb.document.getElementById("elementidhere").click()
manbat42
Posts: 22
Joined: 04 Nov 2017, 11:25

Re: Click on a button

08 Nov 2017, 19:15

Thank you for your answer. I Thougth I had add three files but I can't see them. Tomorrow I'l try again to add them because they are 1-the html code, 2-a prtScr of the page I want to fill and 3-a PrtScr of the windowSpy with the control info. I can't find the Id of the control.
Tomorrow I'l send you mopre info, if I can, because the page I use is in a intranet of my Organization.
Thank you, again.
HIAC
Posts: 111
Joined: 11 Oct 2017, 17:59
Location: Republic of Serbia

Re: Click on a button

08 Nov 2017, 19:22

Okay sure man, no problem.

Meanwhile, check out this easy tool to get webpage info.
https://autohotkey.com/board/topic/8425 ... bbrowser2/
manbat42
Posts: 22
Joined: 04 Nov 2017, 11:25

Re: Click on a button

09 Nov 2017, 12:54

Hi HIAC

I have an image (PNG) with the PrtScr of the iWB2 learner when I drag the cursor over the button I want to click on.
I want to put it here and other files to, but I don't know how to do that. I tried to drag the file in this box but unsucceded. Can you, please, teach me?
In the mean time, here is a link to access those files.
https://www.dropbox.com/sh/9ed17tibjr ... 7G1a?dl=0


Can you tell me something more about how to click on that button?
As you can see, it has no ID.

Greats
HIAC
Posts: 111
Joined: 11 Oct 2017, 17:59
Location: Republic of Serbia

Re: Click on a button

13 Nov 2017, 23:31

Perhaps try by class name

Code: Select all

pwb.document.getElementsByClassName("txt_botao1").item(0).click()

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 321 guests