Lyee Posted July 8, 2018 Share Posted July 8, 2018 Hello, Im working on one function which would save coordinatees of mouse into variable Summary, if I would press F1, coordinates of mouse would save into $Pos[0], another F1 would save it into $Pos[1].... After that I would like to call them into MouseClick I have no idea how to deal with this. Im still learning and those deep variable arent my cup of tea #RequireAdmin Global $Pos[] HotKeySet('{F1}', "_AltForPos") Func _AltForPos() $Pos[0] = MouseGetPos() EndFunc ;==>_AltForPos Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted July 8, 2018 Share Posted July 8, 2018 (edited) Hi @Lyee, and welcome to the AutoIt forum MouseGetPos() returns an array containing, in the first element of it ( $arrMousePos[0], for example ), the X position of the Mouse, and, in the second element of the array ( $arrMousePos[1], for example ), the Y position of the Mouse. So, when you store the Mouse position ( X and Y ), you have to do something like this: Global $arrMousePos = MouseGetPos() _ArrayDisplay($arrMousePos, "Mouse Position") ; or MsgBox($MB_ICONINFORMATION, "Mouse Position:", "X: " & $arrMousePos[0] & @CRLF & "Y: " & $arrMousePos[1]) Hope it helps Best Regards. Edited July 8, 2018 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Lyee Posted July 8, 2018 Author Share Posted July 8, 2018 You didnt get it. I know about this function. I meant if I would press F1 it would save me for example '800, 600' another F1 would save me '420, 600'.. So it would be somehting like: $Pos[0] = 800, 600 $Pos[1] = 420, 600 $Pos[2] = ........... Link to comment Share on other sites More sharing options...
junkew Posted July 8, 2018 Share Posted July 8, 2018 There are different ways of doing this just the 2 below are ones i peferr https://www.autoitscript.com/autoit3/docs/functions/DllStructCreate.htm FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted July 8, 2018 Share Posted July 8, 2018 (edited) @Lyee You have to work a bit with HotKeySet() and MouseGetPos()... If you want to store the X and Y position in a variable, you have to make a Global array, in which you store the X and Y Mouse Position, and the "storage" is done from your n HotKeySet() functions Edited July 8, 2018 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
orbs Posted July 8, 2018 Share Posted July 8, 2018 the simplest approach would be to use ReDim to add another row to your 2-column array, then store the new mouse coordinates in the new row. FrancescoDiMuro 1 Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
junkew Posted July 8, 2018 Share Posted July 8, 2018 Third approach is array in arrays but personally never liked that but maybe others can give good examples. $posa=[10,10] $posb=[20,20] $allpos[2]=[$posa,$posb] FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted July 8, 2018 Share Posted July 8, 2018 @junkew I think the simplest thing ( which @orbs suggested too ) is to declare a multidimensional array ( Pos X and Pos Y ) in which you store X and Y positions, and the you ReDim it. Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
careca Posted July 9, 2018 Share Posted July 9, 2018 Save the coords to ini file at each hotkey press. Essencially $Pos = MouseGetPos() iniwrite $Pos[0] & $Pos[1] ;with propper syntax Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe 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