Sign in to follow this  
Followers 0
AiQA

Drag and Drop

6 posts in this topic

#1 ·  Posted (edited)

Hello

I'm trying to create a relatively simple script and I'm having trouble figuring out where to start with it.

What I want to do is this:

Keypress gets mouse location and triggers a drag and drop from there to a specified coordinates, sets mouse back at original location.

Any information on helping me get this started would be appreciated.

Thanks.

Edited by AiQA

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Here's something to get you started:

$cInfo = GUIGetCursorInfo()
If $cInfo[2] = 0 Then
;If the left mouse key is up

$mousePos = MouseGetPos()
;Get the mouse's position (x,y)

$origX =;The X to start dragging from
$origY =;The Y to start dragging from
$destX =;The X to stop dragging at
$destY =;The Y to stop dragging at

MouseClickDrag("left", $origX, $origY, $destX, $destY)
;MouseClickDrag(Mouse button to press, X to start drag from, Y to start drag from, X to end drag, Y to end drag)

;Good luck!
EndIf

EDIT: Replaced "}" with "EndIf". Whoops.

Edited by motionman95

Share this post


Link to post
Share on other sites

you could also use hotkeyset to set the hot key rather than constantly polling for it. Great example. Just enough to get started without giving the script.

Share this post


Link to post
Share on other sites

Thanks for the help!

Using the basics supplied by motionman95 I've set it into a function and using qazwsx idea of using hotkeyset set a key to call the script.

However when I run the script it doesn't seem to do anything. No error or tray icon. Do I need to set up a While to call the function? Ideally I'd like to be able to run the draganddrop script on a keypress.

Thanks.

Share this post


Link to post
Share on other sites

Thanks for the help!

Using the basics supplied by motionman95 I've set it into a function and using qazwsx idea of using hotkeyset set a key to call the script.

However when I run the script it doesn't seem to do anything. No error or tray icon. Do I need to set up a While to call the function? Ideally I'd like to be able to run the draganddrop script on a keypress.

Thanks.

I've figured it all out and got it to work. Thanks for your help!

I have another question though. Is there a faster movement function than the drag and drop? I see it click, drag, drop.. but is there a way to speed up the process or make the mouse move faster? With predetermined end coordinates would it be faster to set a click and unclick?

Share this post


Link to post
Share on other sites

I've figured it all out and got it to work. Thanks for your help!

I have another question though. Is there a faster movement function than the drag and drop? I see it click, drag, drop.. but is there a way to speed up the process or make the mouse move faster? With predetermined end coordinates would it be faster to set a click and unclick?

Found the speed modifier. :P

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
Sign in to follow this  
Followers 0