jusefarabi Posted November 1, 2005 Share Posted November 1, 2005 (edited) 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 November 1, 2005 by jusefarabi Link to comment Share on other sites More sharing options...
Knight Posted November 1, 2005 Share Posted November 1, 2005 (edited) While 1 MouseClick ("left") Sleep(7000) WEnd Edited November 1, 2005 by Knight Link to comment Share on other sites More sharing options...
jusefarabi Posted November 1, 2005 Author Share Posted November 1, 2005 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 More sharing options...
Confuzzled Posted November 1, 2005 Share Posted November 1, 2005 There is lots of discussion in these forums about this topic. Search for 'OCR' and 'WOW'. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 1, 2005 Moderators Share Posted November 1, 2005 (edited) 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 November 1, 2005 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 More sharing options...
jusefarabi Posted November 1, 2005 Author Share Posted November 1, 2005 Thank you very much, this helps greatly. Might the sleep command also work for sending keystrokes as well, i am also attempting to add timed sleep key strokes into the script. Link to comment Share on other sites More sharing options...
themax90 Posted November 1, 2005 Share Posted November 1, 2005 No you do not understand the idea of sleep. It halts your script for an amount of miliseconds and then continues, so if I had Sleep(1000) it would wait one second to continue the script. Look in the help file please AutoIt Smith Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 1, 2005 Moderators Share Posted November 1, 2005 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 More sharing options...
Moderators SmOke_N Posted November 1, 2005 Moderators Share Posted November 1, 2005 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 More sharing options...
jusefarabi Posted November 2, 2005 Author Share Posted November 2, 2005 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now