HaNdLoRdz Posted November 29, 2010 Share Posted November 29, 2010 (edited) i want to make macro (not game of course)... i got several coordinat,let say : (x1,y1),(x2,y2),(x3,y3),(x4,y4),(x5,y5) n i want to use that coordinat using MouseMove() how can i get random coordinat everytime i start the program??? ie: random() func random() mousemove(x1,y1) or (x2,y2) or (x3,y3) ;something like that?? sleep(20) endfunc pls help me...thx Edited November 29, 2010 by HaNdLoRdz Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 29, 2010 Moderators Share Posted November 29, 2010 HaNdLoRdz,Store the required coordinate pairs in an array and then use Random with the integer flag to return a random index for the pair to use. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
JohnOne Posted November 29, 2010 Share Posted November 29, 2010 Also, you cannot use Random() as a user function, its a autoit native function. So you should use _Random() for your function name. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
HaNdLoRdz Posted November 29, 2010 Author Share Posted November 29, 2010 HaNdLoRdz, Store the required coordinate pairs in an array and then use Random with the integer flag to return a random index for the pair to use. M23 hmmm...like this??? $array[0] = x1,y1 $array[1] = x2,y2 $array[2] = x3,y3 ...etc... mousemove(random($array[ ])) hmm...sorry im still learning about array.,.,so i need help to fix it to be right code... thx for the help Link to comment Share on other sites More sharing options...
HaNdLoRdz Posted November 29, 2010 Author Share Posted November 29, 2010 Also, you cannot use Random() as a user function, its a autoit native function. So you should use _Random() for your function name. oh ok JohnOne,,,thx for the help... yeah i will use it..coz its just a sample code..the problem is with array condition,can i use : $Array[0] = x1 , x2 ??? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 29, 2010 Moderators Share Posted November 29, 2010 HaNdLoRdz, A quick demo script: ; Press Escape to exit HotKeySet("{ESC}", "On_Exit") Global $aCoords[4][2] = [ _ [100, 100], _ [200, 200], _ [300, 300], _ [400, 400]] While 1 ; Get random integer 0 to 3 $iIndex = Random(0, 3, 1) ; And usse it to choose a pair of coordinates from the array MsgBox(0, "This time round", "We would click at" & @CRLF & $aCoords[$iIndex][0] & " x " & $aCoords[$iIndex][1]) WEnd Func On_Exit() Exit EndFunc M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
HaNdLoRdz Posted November 29, 2010 Author Share Posted November 29, 2010 HaNdLoRdz, A quick demo script: ; Press Escape to exit HotKeySet("{ESC}", "On_Exit") Global $aCoords[4][2] = [ _ [100, 100], _ [200, 200], _ [300, 300], _ [400, 400]] While 1 ; Get random integer 0 to 3 $iIndex = Random(0, 3, 1) ; And usse it to choose a pair of coordinates from the array MsgBox(0, "This time round", "We would click at" & @CRLF & $aCoords[$iIndex][0] & " x " & $aCoords[$iIndex][1]) WEnd Func On_Exit() Exit EndFunc M23 argghhh,,.,damn u M23...u help me so much..LOL Big THanx for u buddy... i think i got enough from ur "Quick Script" thx alot bro... 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