AutoHotkey Community

It is currently May 26th, 2012, 11:11 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 83 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next
Author Message
PostPosted: November 5th, 2009, 1:19 am 
Offline

Joined: March 6th, 2008, 11:54 pm
Posts: 167
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 5th, 2009, 1:28 am 
Offline

Joined: October 26th, 2009, 6:29 am
Posts: 362
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 5th, 2009, 2:22 am 
Online

Joined: April 8th, 2009, 7:49 pm
Posts: 6067
Location: San Diego, California
I don't know what an "onclick button" is.
Quote:
without using MouseClick

Why can't you use MouseClick command ?

All three of these routines below ,use the mouse to do the clicking.

Code:
#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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 5th, 2009, 2:40 am 
Offline

Joined: March 6th, 2008, 11:54 pm
Posts: 167
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 5th, 2009, 2:47 am 
Offline

Joined: April 8th, 2009, 8:23 pm
Posts: 3036
Location: Rio de Janeiro - RJ - Brasil
I suggest COM or maybe ImageSearch.

_________________
"Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried.
"
Image
Antonio França
My stuff: Google Profile


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 5th, 2009, 3:13 am 
Offline

Joined: March 6th, 2008, 11:54 pm
Posts: 167
To be honest I know COM. can you give a brief example of a COM script that utilizes a hotkey?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 5th, 2009, 3:20 am 
Online

Joined: April 8th, 2009, 7:49 pm
Posts: 6067
Location: San Diego, California
Flight4birds wrote:
sorry, the onclick command is a function within a webpage.
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.

FYI, I know imagesearch pretty well, if COM doesn't work for you.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 5th, 2009, 3:27 am 
Offline

Joined: March 6th, 2008, 11:54 pm
Posts: 167
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 5th, 2009, 3:41 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Does the element index 591 remain constant? Then, you may try
Code:
COM_Invoke(pwb, "document.all[591].click") ; with AHK and COM
or
Code:
pwb.document.all(591).click() ; with AHK_L and COM_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 5th, 2009, 3:49 am 
Online

Joined: April 8th, 2009, 7:49 pm
Posts: 6067
Location: San Diego, California
Does the vertical scrollbar on the side of the browser count ? :wink: Check out the two scripts in my post.
http://www.autohotkey.com/forum/viewtop ... ht=#290383

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 5th, 2009, 4:14 am 
Offline

Joined: March 6th, 2008, 11:54 pm
Posts: 167
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?


Code:
^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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 5th, 2009, 4:17 am 
Offline

Joined: March 6th, 2008, 11:54 pm
Posts: 167
scratch that, the element does NOT remain constant. Sean ,your thoughts?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 5th, 2009, 4:19 am 
Offline

Joined: October 26th, 2009, 6:29 am
Posts: 362
You will need to #include


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 5th, 2009, 4:33 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
You can/better use Id, save, if the save Id is unique. You have to first store pwb as a global variable.
Code:
^a::COM_Invoke(pwb, "document.all[save].click")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 5th, 2009, 5:13 am 
Offline

Joined: March 6th, 2008, 11:54 pm
Posts: 167
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?


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 83 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: joetazz, JSLover, Maestr0, rbrtryn, Tipsy3000, WillTroll and 62 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group