Jump to content

Multiple coordinates in varriable


Recommended Posts

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

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 by FrancescoDiMuro

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

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

@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 by FrancescoDiMuro

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

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.

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...