Draegon Posted October 26, 2009 Share Posted October 26, 2009 I am trying to do MouseClick but I don't know how to find my X and Y, I am using a 1024 768 if anyone needs to know. Please help! Link to comment Share on other sites More sharing options...
omikron48 Posted October 26, 2009 Share Posted October 26, 2009 Try MouseGetPos. Better yet, read the Functions under Mouse Control in the Function Reference in the help file. Link to comment Share on other sites More sharing options...
Sobiech Posted October 26, 2009 Share Posted October 26, 2009 I am trying to do MouseClick but I don't know how to find my X and Y, I am using a 1024 768 if anyone needs to know. Please help! I dont know why no one answer to you :\ This is easy Start / Programs / AutoIT v3 / AutoIt Window Info Then you can see small window with all informations what you need. Example >>>> Window <<<< Title: Replying To How do I find X and Y? - AutoIt Forums - Mozilla Firefox Class: MozillaUIWindowClass Position: -8, -8 Size: 1382, 754 Style: 0x15CF0000 ExStyle: 0x00000100 Handle: 0x000501A6 >>>> Control <<<< Class: MozillaWindowClass Instance: 5 ClassnameNN: MozillaWindowClass5 Advanced (Class): [CLASS:MozillaWindowClass; INSTANCE:5] ID: Text: Position: 0, 134 Size: 1349, 562 ControlClick Coords: 589, 408 Style: 0x56000000 ExStyle: 0x00000000 Handle: 0x00100EEA >>>> Mouse <<<< Position: 589, 542 Cursor ID: 5 Color: 0xFFFFFF >>>> StatusBar <<<< >>>> Visible Text <<<< >>>> Hidden Text <<<< In "Summary" Bookmark (there you can see all informations about X window and Mouse Position). Remembaer about "Options / CoordMode". and set in your code ==================== Opt"MouseCoordMode, X(read under this line)" Sets the way coords are used in the mouse functions, either absolute coords or coords relative to the current active window: 0 = relative coords to the active window 1 = absolute screen coordinates (default) 2 = relative coords to the client area of the active window Anything else? This world is crazy Link to comment Share on other sites More sharing options...
Draegon Posted October 26, 2009 Author Share Posted October 26, 2009 Oh and also how do I repeat a script like this: mouseclick ( "left" [, x, y [, 1 [, 100 ]]] ) sleep ( 1000 ) mouseclick ( "left" [, x, y [, 1 [, 100 ]]] ) sleep ( 100 ) mouseclick ( "left" [, x, y [, 1 [, 100 ]]] ) sleep ( 100 ) mouseclick ( "left" [, x, y [, 1 [, 100 ]]] ) sleep ( 30000 ) send ( "F5" [, 0 ] ) Also is there something incorrect with it? Besides the fact I don't have my x and y. Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 26, 2009 Share Posted October 26, 2009 (edited) Another options is the Window Info Tool (AU3Info.exe) included with AutoIt. It can give you mouse coordinates in the relative mode (i.e. Screen or Window) needed for what you're doing. Edit: Oh and also how do I repeat a script like this: mouseclick ( "left" [, x, y [, 1 [, 100 ]]] ) sleep ( 1000 ) mouseclick ( "left" [, x, y [, 1 [, 100 ]]] ) sleep ( 100 ) mouseclick ( "left" [, x, y [, 1 [, 100 ]]] ) sleep ( 100 ) mouseclick ( "left" [, x, y [, 1 [, 100 ]]] ) sleep ( 30000 ) send ( "F5" [, 0 ] ) Also is there something incorrect with it? Besides the fact I don't have my x and y. Look at the example scripts in the help file for the functions you want to use. The square brackets are only used to indicate optional parameters and should not be in your syntax. Edited October 26, 2009 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Draegon Posted October 26, 2009 Author Share Posted October 26, 2009 Thanks PsaltyDS Link to comment Share on other sites More sharing options...
Sobiech Posted October 26, 2009 Share Posted October 26, 2009 You can use While LoopExampleWhile 1 mouseclick ( "left" [, x, y [, 1 [, 100 ]]] ) sleep ( 1000 ) WEndThis loop repeat mouseclick in every 1 second (you must know this loop is infinityif you want use X times, i think the best way will be For LoopNext example:For $s=1 To 6 Step 1 mouseclick ( "left" [, x, y [, 1 [, 100 ]]] ) sleep ( 1000 ) NextThis repeat mouseclick 6 times (To 6) from 1 (For $s=1) and always use +1 (Step 1)At the end of loop you must set"Next" This world is crazy Link to comment Share on other sites More sharing options...
omikron48 Posted October 26, 2009 Share Posted October 26, 2009 (edited) Those square brackets shouldn't be there. While 1 MouseClick("left", $x, $y , 1 , 100) Sleep(1000) MouseClick("left", $x, $y , 1 , 100) Sleep(100) MouseClick("left", $x, $y , 1 , 100) Sleep(100) MouseClick("left", $x, $y , 1 , 100) Sleep(30000) Send("F5") WEnd However, this looks to be made for something that has a refresh, like a webpage or some other application. In that case, you need to make your script wait until the refreshing is finished before you start clicking away. Edited October 26, 2009 by omikron48 Link to comment Share on other sites More sharing options...
Sobiech Posted October 26, 2009 Share Posted October 26, 2009 While 1 MouseClick("left", $x, $y , 1 , 100) Sleep(1000) MouseClick("left", $x, $y , 1 , 100) Sleep(100) MouseClick("left", $x, $y , 1 , 100) Sleep(100) MouseClick("left", $x, $y , 1 , 100) Sleep(30000) Send("F5") WEnd Maybe this should br better ;d $time = 100; I think this is too small delay but who know, i always set ~~300 because my computer like jokes While 1 MouseClick("left", $x, $y , 1 , 100) Sleep($time) MouseClick("left", $x, $y , 1 , 100) Sleep($time) MouseClick("left", $x, $y , 1 , 100) Sleep($time) MouseClick("left", $x, $y , 1 , 100) Sleep(30000) Send("F5") WEnd This world is crazy Link to comment Share on other sites More sharing options...
omikron48 Posted October 26, 2009 Share Posted October 26, 2009 (edited) Depends, if the sleeps aren't supposed to be the same length, then you can't use a simple loop or variable. Edited October 26, 2009 by omikron48 Link to comment Share on other sites More sharing options...
Draegon Posted October 26, 2009 Author Share Posted October 26, 2009 I got it going great, now all I need to know is how to stop the program. It runs forever so I've been having to log of windows and back on again when ever I change it. Can someone help me finish this script? Link to comment Share on other sites More sharing options...
omikron48 Posted October 26, 2009 Share Posted October 26, 2009 Just set a hotkey that exits the program. HotKeySet($key, "_Exit") While 1 MouseClick("left", $x, $y , 1 , 100) Sleep(1000) MouseClick("left", $x, $y , 1 , 100) Sleep(100 MouseClick("left", $x, $y , 1 , 100) Sleep(100) MouseClick("left", $x, $y , 1 , 100) Sleep(30000) Send("F5") WEnd Func _Exit() Exit EndFunc Also, if you see the AutoIt icon in your tray bar (unless you disabled it) you can just right click it when you have control of you mouse. Link to comment Share on other sites More sharing options...
Sobiech Posted October 26, 2009 Share Posted October 26, 2009 (edited) I got it going great, now all I need to know is how to stop the program. It runs forever so I've been having to log of windows and back on again when ever I change it. Can someone help me finish this script? HotKeySet("{F1}", "_exit"); Set the "_exit()" function for "F1" key. Just simple hotkey Func _exit() ; Name of function Exit ; What to do, here is Exit xd EndFunc ; End ;rest of your code Simply? i think it is. Edit: @Omikron48 I know you know this, but you dont set key for "$key" Edited October 26, 2009 by Sobiech This world is crazy Link to comment Share on other sites More sharing options...
omikron48 Posted October 27, 2009 Share Posted October 27, 2009 I just put $key there to indicate that this is where you are supposed to put the key for the hotkey. 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