Jump to content
Lyee

Multiple coordinates in varriable

Recommended Posts

Lyee

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

 

Share this post


Link to post
Share on other sites
FrancescoDiMuro
Posted (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 by FrancescoDiMuro

Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
Lyee

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] = ...........

Share this post


Link to post
Share on other sites
FrancescoDiMuro
Posted (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 by FrancescoDiMuro

Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
orbs

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.

  • Like 1

Share this post


Link to post
Share on other sites
FrancescoDiMuro

@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

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
careca

Save the coords to ini file at each hotkey press.

Essencially

$Pos = MouseGetPos()

iniwrite $Pos[0] & $Pos[1] ;with propper syntax

 


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

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.

Firefox Profile Backup - Backup/restore previously saved profile.

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

Share this post


Link to post
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

×