NutherNoob Posted January 26, 2007 Share Posted January 26, 2007 In my macro I wish to make, the user enters mouse coordinates into coordinate fields (up to 10), then the mouse will go to the first coords and click. After some time, it will do the same again but at the coords of the 2nd field etc etc. What I have atm just doesnt seem to want to click on any coords. How can I write this function so that each coord box is read and executed? $I is the number of fields. Thankyou Func Start() Local $AllFieldEmpty = True For $I = 0 To UBound($CoordsField) - 1 If GUICtrlRead($CoordsField[$I]) <> "" then $AllFieldEmpty = False Next If $AllFieldEmpty Then MsgBox(16, "Error" , "Please enter Coordinates") Return EndIf For $I = 0 To $NumTimeFields - 1 MouseClick("right", $pos[0],$pos[1]) ; pulls up menu sleep(400) MouseClick("left", $pos[0],$pos[1] + Random($XSpot, $YSpot)) ; clicks option in menu Next EndFunc Link to comment Share on other sites More sharing options...
/dev/null Posted January 26, 2007 Share Posted January 26, 2007 (edited) In my macro I wish to make, the user enters mouse coordinates into coordinate fields (up to 10), then the mouse will go to the first coords and click. After some time, it will do the same again but at the coords of the 2nd field etc etc. What I have atm just doesnt seem to want to click on any coords. How can I write this function so that each coord box is read and executed? $I is the number of fields. Thankyou Func Start() Local $AllFieldEmpty = True For $I = 0 To UBound($CoordsField) - 1 If GUICtrlRead($CoordsField[$I]) <> "" then $AllFieldEmpty = False Next If $AllFieldEmpty Then MsgBox(16, "Error" , "Please enter Coordinates") Return EndIf For $I = 0 To $NumTimeFields - 1 MouseClick("right", $pos[0],$pos[1]) ; pulls up menu sleep(400) MouseClick("left", $pos[0],$pos[1] + Random($XSpot, $YSpot)) ; clicks option in menu Next EndFunc you should post the whole code, otherwise nobody can see how $CoordsField and $pos are initialized. Btw: What do you expect to get by reading from $CoordsField? Edited January 26, 2007 by /dev/null __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
NutherNoob Posted January 26, 2007 Author Share Posted January 26, 2007 you should post the whole code, otherwise nobody can see how $CoordsField and $pos are initialized. Btw: What do you expect to get by reading from $CoordsField?The first part checks to see if there's any coords that have been entered. That works fine. Here's the rest.... expandcollapse popup#include <GUIConstants.au3> #Include <Misc.au3> #include <Date.au3> AutoItSetOption("MouseCoordMode", 1) ;Use Mouse Coordinates relative to: ;1-rel to screen HotKeySet("{PAUSE}", "Terminate") HotKeySet("{ENTER}", "Paste") ;master gui vars $master_gui_width = 285 $master_gui_hight = 270 ; variables group $default_group_width = 200 $x_var_group = 5 $y_var_group = 10 $var_group_width = $default_group_width $var_group_hight = $master_gui_hight - 100 ;positions vars group $pdefault_group_width = ($master_gui_width - $default_group_width) $px_var_group = 206 $py_var_group = 10 $pvar_group_width = $pdefault_group_width -10 $pvar_group_hight = $master_gui_hight - 100 ; = END DEFINE VARIABLES ; ===== START MASTER GUI GUICreate("=- Test -=", $master_gui_width, $master_gui_hight , -1, -1, -1) GUISetState () WinSetOnTop("=- Test -=", "", 1) ; MENU GuiCtrlCreateMenu("Menu &One") GuiCtrlCreateMenu("Menu &Two") GUICtrlCreateGroup ("Times", $x_var_group , $y_var_group , $var_group_width , $var_group_hight) GUICtrlCreateGroup ("",-99,-99,1,1) ;close group GUICtrlCreateGroup ("Positions", $px_var_group , $py_var_group , $pvar_group_width , $pvar_group_hight) GUICtrlCreateGroup ("",-99,-99,1,1) ;close group ;Hrs, secs title $widthCell=100 GUICtrlCreateLabel ("Hrs. Mins. Secs.", 50 , 30, $widthCell) Local Const $NumTimeFields = 3 ; can be up to 10 Local $HourFields[$NumTimeFields] Local $MinuteFields[$NumTimeFields] Local $SecondFields[$NumTimeFields] Local $ProgressBar[$NumTimeFields] Local $CoordsField[$NumTimeFields] Local $Sec, $Min, $Hour, $Time, $XSpot, $YSpot $widthCellb=40 $diff=22 For $I = 0 To $NumTimeFields - 1 Local $Y = $y_var_group + $diff * ($I + 2) - 3 Local $Label = 'Eg ' & $I + 1 & '.' GUICtrlCreateLabel($Label, $x_var_group + 2, $Y +3, $widthCellb) $HourFields[$I] = GUICtrlCreateInput('', 50, $Y, 18, 17, $ES_NUMBER) $MinuteFields[$I] = GUICtrlCreateInput('', 79, $Y, 18, 17, $ES_NUMBER) $SecondFields[$I] = GUICtrlCreateInput('', 108, $Y, 18, 17, $ES_NUMBER) $ProgressBar[$I] = GuiCtrlcreateProgress(130, $Y+2, 70, 13) $CoordsField[$I] = GUICtrlCreateinput("", 213, $Y, 60, 17) Next $start=GUICtrlCreateButton("START", 228, $Y + 100, 45, 30) GUICtrlSetOnEvent($start,"Start") GuiSetState() ;When Start button clicked..... ;Checks for any x,y coords in coords fields, if none, Error msg ;Loop.....Right Clicks coords from 1st coords box and waits the specified time showing tooltip countdown ;When countdown reaches 0, clicks 2nd coords box and countsdown until all finished ......endloop While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $start Start() EndSelect $pos = MouseGetPos() ToolTip("" & $pos[0] & ", " & "" & $pos[1] & " Pause2exit") Sleep(10) If _Ispressed(10) then ; if SHIFT is pressed $pos = MouseGetPos() ClipPut($pos[0] & "," & $pos[1]) Endif WEnd Func Start() Local $AllFieldEmpty = True For $I = 0 To UBound($CoordsField) - 1 If GUICtrlRead($CoordsField[$I]) <> "" then $AllFieldEmpty = False Next If $AllFieldEmpty Then MsgBox(16, "Error" , "Please enter Coordinates") Return EndIf For $I = 0 To $NumTimeFields - 1 MouseClick("right", $pos[0],$pos[1]) ; pulls up menu sleep(400) MouseClick("left", $pos[0],$pos[1] + Random($XSpot, $YSpot)) ; clicks option in menu Next EndFunc ; Tooltip Countdown For $I = 0 To $NumTimeFields - 1 ToolTip("Now running number " & $I & "....Waiting " & $HourFields[$I] & " hours, " & $MinuteFields[$I] & " minutes, " & $SecondFields[$I] & " seconds.", 210, 3) ; sleep((_TimeToTicks($HourFields[$I], $MinuteFields[$I], $SecondFields[$I]))) ; countdown Next ;Paste coords Func Paste() Send(ClipGet()) EndFunc Func Terminate() Exit EndFunc ;==>Terminate 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