Jump to content

Mouse Clicks - Setting options - Clarification


Recommended Posts

Hi, sorry to ask this , it might have already been covered in the documentation, i am just looking for some mouse clicking clarification concerning setting options.

How do i set the mouse to click at certain intervals?

Is this how i do it?

MouseClick ("left")

AutoItSetOption ("MouseClickDelay" , 700)

Is this how i would get autoit to automatically click the mouse wherever i leave the cursor every seven seconds?

Sorry if this is an obvious question, im just trying to figure things out, im completely new to AutoIt, and im just starting with the basics before i attempt the more complicated things, although im sure ill be back with more questions, some easy, some not so easy..

Thanks for reading.

Sorry, what i am attempting is to get the mouse to keep clicking every seven seconds where i leave the cursor.

Edited by jusefarabi
Link to comment
Share on other sites

Thank you very much. Now i am looking to do something more advanced, im reading about it right now, but any help would still be much appreciated.

I am attempting make a checker, to check for a pixel variable, so that if the pixel at a certain part of the screen is one colour, it will input a keystroke, while if it is not it will not input a keystroke.

Ill attempt to clarify more. I am attempting to create a script that will perform a certain action, such as pressing the F1 key, only when the pixel colour at a certain part of the screen is brown grey or white, while if it is red blue or black it will not do anything.

I will be reading how to do this right now.

Thanks again for the help Knight.

Link to comment
Share on other sites

  • Moderators

PixelGetColor() and Send() or ControlSend() are some things you'll be looking at in the help file.

Example:

;Loop till it finds the color then exit ... you can remove the exit, but make sure you have it to where you can exit the program manually with the icon in the task bar or a "HotKeySet()"

While 1; beginning of loop

   If PixelGetColor(1, 1) == 0xFF0000 Then; if x coord 1 and y coord 1 = Red
      Send("a"); send "a" to the window you found the color in
      ExitLoop; will exit the loop after it send (this can be removed as above)
   EndIf

Sleep(1000); pause for approximately 1 second as not to overload CPU

Wend; enclose the loop

hope this helps

Edit: Forgot to add the end code tag..

Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

He's asking good questions for other newbies that read the thread IMHO.

You can use

Opt("SendKeyDelay", 5) ; you can replace 5 with anything you want other than "0"... you can but it's not recommended.

That slows down or speeds up your send strokes if that's what you're asking.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Also if your looking at sending them timed persay... after x amount of time send this keystroke, something like this might work: Be sure to look up timerinit() and timerdiff() in help to fully understand.

This will alow your script to keep running while the timer is still working:

Opt("WinTitleMatchMode", 4); look at Opt and wintitle match too suit your needs for window title
Opt("PixelCoordMode", 0); replace 0 with 1 if your getting you are getting screen coords or 2 if you're getting client coords from AutoInfo Tool.
Opt("MouseCoordMode", 0); replace 0 with 1 if your getting you are getting screen coords or 2 if you're getting client coords from AutoInfo Tool.
Opt("SendKeyDelay", 5); replace 5 with anything you want other than "0"... you can but it's not recommended

; This sets the title in a variable so you don't have to keep typing the name
Dim $WINDOW = "Game/or Whatever"; Put the actual title that appears in place of Game/or Whatever, be sure to leave the quotes

$TIMER = TimerInit(); Start the timer before the loop starts, if you do it inside the loop, it will keep resetting, so do it outside
While 1; beginning of loop

   If PixelGetColor(1, 1) == 0xFF0000 Then; if x coord 1 and y coord 1 = Red
      Send("a"); send "a" to the window you found the color in
      ExitLoop; will exit the loop after it send (this can be removed as above)
   EndIf

   If TimerDiff($TIMER) / 1000 >= 30 Then; If the time difference is greater than or equal to 30 seconds then do a command
       MsgBox(0, "Command", "You have reached here because it's been 30 seconds or more"); you can replace the msgbox with send()
       $TIMER = TimerInit(); Reset the timer
   EndIf

Sleep(1000); pause for approximately 1 second as not to overload CPU

Wend; enclose the loop

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Wow, this is technical.

I thank you all for your lengthy explanations, they are very helpful, and have helped me understand that i need to start with more simple things.

Thanks again for all the input, i feel like the whole pixel thing is a little bit too much for me at the moment, so i am asking simpler questions and starting off with much easier tasks for scripting.

Hopefully, i will be able to understand the examples you all sent me in a couple of months.

Thank you.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...