Jump to content

Drag and Drop


Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
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.

Link to comment
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?

Link to comment
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
Link to comment
Share on other sites

  • 9 years later...

I have a question. I understand the code above and it works perfect in my script.

However I need help with having to repeat this task. Meaning, I need to select the rows below one at time and drag and drop to the window on the right until there are no rows left on the left hand side.

I need to create an array and loop but I am not sure on how to go about doing it.

Thanks.

Link to comment
Share on other sites

  • Moderators

@Meg did you happen to notice this post is over 9 years old? Autoit is constantly growing and changing as a language; what worked a decade ago may not work the same now (hopefully it is easier). This is one reason we discourage people from resurrecting very old threads. You will get a lot better response if you simply create a new thread, explaining what you are trying to do (in as much detail as possible), what you have tried on your own (post your code) and what issues, errors, etc. you're having.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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