Jump to content

Recommended Posts

Guest KageReza
Posted

i am making a script to drag and drop items from a possition that I select on my desktop, and drag it to a spot that I select on my desktop. I neeed a command that will allow me to get those 2 possitions so that i can put them my script. So far i have used MouseGetPos, but i can only get one possition with that. Is there a way to get 2, by using it in the same script?

Posted (edited)

i am making a script to drag and drop items from a possition that I select on my desktop, and drag it to a spot that I select on my desktop. I neeed a command that will allow me to get those 2 possitions so that i can put them my script. So far i have used MouseGetPos, but i can only get one possition with that. Is there a way to get 2, by using it in the same script?

<{POST_SNAPBACK}>

Perhaps someone else has a better way, but here's what I just came up with. It uses the space bar as a hot key to tell the script when the mouse is in the desired position.

HotKeySet("{SPACE}", "_PointPicked")

$aPick1 = 0
$aPick2 = 0
SplashTextOn("1st Point", "Position Mouse at 1st point and press the SPACE bar", 450, 20)
While $aPick1 = 0
  sleep(10)
Wend

SplashTextOn("2nd Point", "Position Mouse at 2nd point and press the SPACE bar", 450, 20)
While $aPick2 = 0
  sleep(10)
Wend
SplashOff()

MsgBox(4096, "Picked points", "The 2 picked points are:" & @lf & $aPick1[0] & "," & $aPick1[1] & @lf &  $aPick2[0] & "," & $aPick2[1])
Exit

Func _PointPicked()
  If $aPick1 = 0 Then
    $aPick1 = MouseGetPos()
  Else
    $aPick2 = MouseGetPos()
    HotKeySet("{SPACE}")
  EndIf
EndFunc

EDIT: Added 2 sleeps

Edited by phillip123adams

Phillip

Guest KageReza
Posted

Thanks alot. that help out alot.

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
  • Recently Browsing   0 members

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