Razelto Posted January 6, 2017 Share Posted January 6, 2017 hello i am new to autoit forums and i need some help i want to set mouse location without moving it or use mousegetpos my example is easy i need to declare 3 locations and get them from other script i have $X1 and $Y1 but what i need is $location1 = $X1, $Y1 but i know won´t work like that location.au3 Link to comment Share on other sites More sharing options...
spudw2k Posted January 6, 2017 Share Posted January 6, 2017 One option, you could employ an multidimensional array to hold the coordinate(s) then reference them as such. ;Enums just for ease of use Global Enum $COORD_X, $COORD_Y ;Declare and Initilize Array ; X Y Local $aLocation[1][2]=[[780,600]] MouseMove ($aLocation[0][$COORD_X], $aLocation[0][$COORD_Y]) ToolTip("mouse is here") or Global Enum $COORD_X, $COORD_Y ;Declare array and assign values "later" Local $aLocation[1][2] $aLocation[0][$COORD_X] = 780 $aLocation[0][$COORD_Y] = 600 MouseMove ($aLocation[0][$COORD_X], $aLocation[0][$COORD_Y]) ToolTip("mouse is here") Not sure how much value that adds for you, but there's an example. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Razelto Posted January 6, 2017 Author Share Posted January 6, 2017 thank you for your fast answer but i just reliazed it is not possible what i wated mousemove needs both x and y to be declared, mousemove($location1) would be a bad statement Link to comment Share on other sites More sharing options...
spudw2k Posted January 6, 2017 Share Posted January 6, 2017 Correct, you have to provide both coords to the mousemove function. You could make a custom function that parses and passes the coords to the mousemove func. crude example: #include <StringConstants.au3> _MoveMouse("780,600") Func _MoveMouse($sCoords = "0,0") $aCoords = StringSplit($sCoords,",",$STR_NOCOUNT) If UBound($aCoords) <> 2 Then Return SetError(1,0,0) Return MouseMove($aCoords[0],$aCoords[1]) EndFunc Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Razelto Posted January 6, 2017 Author Share Posted January 6, 2017 i was just thinking anout fuction and then call the function, i am learning ... thanks for the help Quote Func location1() $X1 =780 $Y1 = 600 MouseMove ($X1, $Y1) ToolTip("mouse is here") Sleep(2000) EndFunc Func location2() $X2 =600 $Y2 = 708 MouseMove ($X2, $Y2) ToolTip("mouse is here") Sleep(2000) EndFunc location1() Location2() Link to comment Share on other sites More sharing options...
Razelto Posted January 6, 2017 Author Share Posted January 6, 2017 I got it solved. I made 3 funcitions and then call them from main file. I need to call them like 20 times that´s why i wated more simple not always typing coords. Func location1() $X1 =780 $Y1 = 100 MouseMove ($X1, $Y1) Sleep(100) MouseClick("left",$X1,$Y1,1) EndFunc Func location2() $X2 =780 $Y2 = 225 MouseMove ($X2, $Y2) Sleep(100) MouseClick("left",$X2,$Y2,1) EndFunc Func location3() $X3 =780 $Y3 = 350 MouseMove ($X3, $Y3) Sleep(100) MouseClick("left",$X3,$Y3,1) EndFunc Once again thanks and sorry for spamming, I am new. Link to comment Share on other sites More sharing options...
spudw2k Posted January 6, 2017 Share Posted January 6, 2017 (edited) All good; if you want to improve your coding skillz, take another look at my example. I created a custom (modular) function that I can provide coordinates to. It's more efficient than copying and pasting more-or-less the same code over and over. Write once, run many. ;untested _MoveAndClickMouse(780,600) _MoveAndClickMouse(780,225) _MoveAndClickMouse(780,350) Func _MoveAndClickMouse($X, $Y) MouseMove($X,$Y) Sleep(100) MouseClick("Left",$X,$Y,1) EndFunc Just a suggestion for consideration Edited January 6, 2017 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Razelto Posted January 6, 2017 Author Share Posted January 6, 2017 Your example works very well, but it does all together. I want to call them at specified time, using timer, in other situations works flawless. 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