Hey guys, I'd like to execute an onclick button on a website without using MouseClick to send it to the x,y coordinates.
The website I need it on is an internal work site so I can't give the address. I'd like to create a script such that when a hotkey is pressed it executes an onclick button on the webpage.
Using tank's iWebBrowser2 Learner, I got the button's info.ID=save, onclick=process(event) and I'm not sure if this is relevant but the EleIndex is 591.
I know I need more. Can you point me in the right direction
I tried looking on the forum for an answer to this but haven't found it.
Thanks for your help.
Need help w/ hotkey to execute an onclick button on webpage.
Started by
4birds
, Nov 05 2009 12:19 AM
82 replies to this topic
#1
-
Posted 05 November 2009 - 12:19 AM
I havent had the need to do browser automation nor do I know how to really but... Com is all I can suggest. Sean was on earlier maybe he will post and help afterall he made the com library.
#2
-
Posted 05 November 2009 - 12:28 AM
I don't know what an "onclick button" is.
All three of these routines below ,use the mouse to do the clicking.
Why can't you use MouseClick command ?without using MouseClick
All three of these routines below ,use the mouse to do the clicking.
#Persistent CoordMode, ToolTip, screen ; without these commands, x & y are realative to window CoordMode, Mouse, screen CoordMode, Pixel, screen x=-425 y=225 return F1:: mousegetpos, xp, yp mousemove,x,y, 50 mouseclick, left mousemove,xp,yp, 50 return f2:: Click, left %X%, %Y% RETURN f3:: Send {Click %X%, %Y%, left} return
#3
-
Posted 05 November 2009 - 01:22 AM
sorry, the onclick command is a function within a webpage.
so, if you were to click the button on a webpage with your mouse it would trigger whatever that button was programmed to do.
One of my problems is that the button will change x,y coordinates every so often and of course is different on each computer that I own.
so, if you were to click the button on a webpage with your mouse it would trigger whatever that button was programmed to do.
One of my problems is that the button will change x,y coordinates every so often and of course is different on each computer that I own.
#4
-
Posted 05 November 2009 - 01:40 AM
I suggest COM or maybe ImageSearch.
#5
-
Posted 05 November 2009 - 01:47 AM
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Antonio França -- git.io -- github.com -- ahk4.net -- sites.google.com -- ahkscript.org
Member of the AHK community since 08/Apr/2009. Moderator since mid-2012.
To be honest I know COM. can you give a brief example of a COM script that utilizes a hotkey?
#6
-
Posted 05 November 2009 - 02:13 AM
Thanks. I seem to have come across that term when I did a "view ->source" on a webpage. I didn't remember until you jogged my memory.sorry, the onclick command is a function within a webpage.
FYI, I know imagesearch pretty well, if COM doesn't work for you.
#7
-
Posted 05 November 2009 - 02:20 AM
Leef_Me, you said you know imagesearch, but can you make a script that will mouseclick the coordinates of an image, even if the image shows up on different places from time to time?
#8
-
Posted 05 November 2009 - 02:27 AM
Does the element index 591 remain constant? Then, you may try
COM_Invoke(pwb, "document.all[591].click") ; with AHK and COMor
pwb.document.all(591).click() ; with AHK_L and COM_L
#9
-
Posted 05 November 2009 - 02:41 AM
Does the vertical scrollbar on the side of the browser count ? :wink: Check out the two scripts in my post.
<!-- m -->http://www.autohotke... ... ht=#290383<!-- m -->
Just to get a running start, I suggest trying out the first script in that post.
Please be forwarned, it does a UrlDownloadToFile if it doesn't find the needed gif in the same directory as your script.
btw, for images I want to detect that aren;t read-made gifs, I use printscreen and paint and save as 24 bit BMP.
edit: :oops: you'll need to add a mouseclick statement or change the mousemove statement.
edit2: of course, the image will have to be visible to be found by imagesearch
<!-- m -->http://www.autohotke... ... ht=#290383<!-- m -->
Just to get a running start, I suggest trying out the first script in that post.
Please be forwarned, it does a UrlDownloadToFile if it doesn't find the needed gif in the same directory as your script.
btw, for images I want to detect that aren;t read-made gifs, I use printscreen and paint and save as 24 bit BMP.
edit: :oops: you'll need to add a mouseclick statement or change the mousemove statement.
edit2: of course, the image will have to be visible to be found by imagesearch
#10
-
Posted 05 November 2009 - 02:49 AM
Sean, thanks for your response.
Now while I'm not necessarily new to AHK, I'm not a good programmer and have not used COM yet.
I do have it in my AHK folder, but never really understood what exactly it was for.
Anyways, element index 591 does remain constant.
So let's say I only want to click that element index only at certain times, can I use a hotkey to trigger it?
I mean would something like this work?
or do COM scripts not work like this?
Where do I need to place the AHK script so it will correct work with COM?
Essential, if I'm uses COM scripts, where do I place them and how do I activate them?
Sean, thanks for your help and patience.
Now while I'm not necessarily new to AHK, I'm not a good programmer and have not used COM yet.
I do have it in my AHK folder, but never really understood what exactly it was for.
Anyways, element index 591 does remain constant.
So let's say I only want to click that element index only at certain times, can I use a hotkey to trigger it?
I mean would something like this work?
^a:: COM_Invoke(pwb, "document.all[591].click")
or do COM scripts not work like this?
Where do I need to place the AHK script so it will correct work with COM?
Essential, if I'm uses COM scripts, where do I place them and how do I activate them?
Sean, thanks for your help and patience.
#11
-
Posted 05 November 2009 - 03:14 AM
scratch that, the element does NOT remain constant. Sean ,your thoughts?
#12
-
Posted 05 November 2009 - 03:17 AM
You can/better use Id, save, if the save Id is unique. You have to first store pwb as a global variable.
^a::COM_Invoke(pwb, "document.all[save].click")
#14
-
Posted 05 November 2009 - 03:33 AM
Sean, it didn't seem to work. the save ID is unique. Is the code you packaged up all ready to go or did I need to add something?
#15
-
Posted 05 November 2009 - 04:13 AM