AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need help with mouse cliks please.

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
juliea



Joined: 08 Feb 2010
Posts: 5

PostPosted: Mon Feb 08, 2010 1:41 am    Post subject: Need help with mouse cliks please. Reply with quote

I have read through the help manual for the software paying special attention to mouse clicks since I wanted to make a repetitive mouse click script.Am a complete noob I just started today with scripts and I have no idea what am doing. Embarassed

So as you can guest my code is not working.
This is what I got from the tuts.

SendMode Input

Loop, 50
{
Click 302, 274
Sleep 10000

click 391, 490
Sleep 10000

Click 302, 274
Sleep 10000
}

I know it is not right because my mouse keeps moving too fast and it is clicking wrong links before the page loads.

I wanted it to click a link and load a page.Then wait for it to load then click another link which will carry it back to the first page.I wanted this to loop 50 times.

And also how do I code it to stop at my command?
Any help is appreciated thanks.
Back to top
View user's profile Send private message
Sergio



Joined: 16 Mar 2008
Posts: 160
Location: Brooklyn

PostPosted: Mon Feb 08, 2010 7:01 am    Post subject: Reply with quote

Well the code itself does what I would expect it to do. It clicks in the designated area, waits 10 seconds and clicks in the other area. It continues as expected.

It does seem that the biggest problem is not in the programming, but in conceptualizing the application. Can I ask what you need this to do? Maybe there is a better approach.
_________________
Back to top
View user's profile Send private message
juliea



Joined: 08 Feb 2010
Posts: 5

PostPosted: Mon Feb 08, 2010 4:37 pm    Post subject: Reply with quote

Thanks for trying it out.
Well here is what I wanted to use it on.
It is just accepting things from a main page and going back and accept again

This is the first page


This is the second page that will load.


Then it will go back to the first page again and accept the other request.

http://i424.photobucket.com/albums/pp327/jonnade/again-1.png
Back to top
View user's profile Send private message
juliea



Joined: 08 Feb 2010
Posts: 5

PostPosted: Mon Feb 08, 2010 5:34 pm    Post subject: Reply with quote

Does it matter that am using firefox?
Back to top
View user's profile Send private message
juliea



Joined: 08 Feb 2010
Posts: 5

PostPosted: Tue Feb 09, 2010 6:50 pm    Post subject: Reply with quote

I still need help pls.
Back to top
View user's profile Send private message
tomoe_uehara



Joined: 05 Sep 2009
Posts: 1591
Location: Somewhere near you

PostPosted: Tue Feb 09, 2010 6:54 pm    Post subject: Reply with quote

Have you try to increase the sleep value?
Code:
SendMode Input

F4::    ;<--- Press F4 to activate the script.
Loop, 50
{
Click 302, 274
Sleep 10000     ;<---- Have you try to increase this value?

click 391, 490
Sleep 10000     ;<---- And this...

Click 302, 274
Sleep 10000     ;<---- And this too
}

F5::reload    ;<--- Press F5 to stop the script

_________________

The quick onyx goblin jumps over the lazy dwarf
Back to top
View user's profile Send private message
OceanMachine



Joined: 15 Oct 2007
Posts: 780
Location: England

PostPosted: Tue Feb 09, 2010 7:54 pm    Post subject: Reply with quote

Hi.

Are the clicks happening too early (i.e. before the page has finished loading)?

To test this, try the below (shamelessly based on the code tomoe_uehara posted earlier) - this is just so you can check when the clicks are actually being triggered:

Code:
SendMode Input
SetTitleMatchMode, 2

F4::    ;<--- Press F4 to activate the script.
Loop, 50
{
   WinActivate, Mozilla Firefox
   Click 302, 274
   GoSub, SleepCheck

   WinActivate, Mozilla Firefox
   Click 391, 490
   GoSub, SleepCheck

   WinActivate, Mozilla Firefox
   Click 302, 274
   GoSub, SleepCheck
}
Return

SleepCheck:
   ContinueSleep := true
   TryNumber := 0

   while(ContinueSleep)
   {
      TryNumber += 1

      Sleep 10000 ; increase this until the page is always ready before the message appears for Try Number 1 for each page.

      MsgBox, 4, Click next page?, Try Number %TryNumber% for this page:`n`nTimer is up! If you see this message before the page is displayed correctly, you need to increase the sleep duration!`n`nIf you click No, the script will wait some more and ask you again, if you click Yes, the next click will happen.`n`nIs the page ready for the next click?

   IfMsgBox, Yes
     ContinueSleep := false
   }
Return

F5::reload    ;<--- Press F5 to stop the script


If you are getting the messages popping up too early, try increasing the sleep duration until you are in the situation where the page is always ready before the messages appear. Once you have that, copy that sleep duration into your code that you posted above (i.e. the one with just the clicks and sleeps), and you should be ok.

remember you will need to press F4 to start the script, and F5 to stop/reload it!
Back to top
View user's profile Send private message
juliea



Joined: 08 Feb 2010
Posts: 5

PostPosted: Wed Feb 10, 2010 2:06 am    Post subject: Reply with quote

Thank you both very much it worked it really was clicking too early.
I really am grateful for your help.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group