AiQA Posted March 2, 2009 Share Posted March 2, 2009 (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 March 2, 2009 by AiQA Link to comment Share on other sites More sharing options...
motionman95 Posted March 2, 2009 Share Posted March 2, 2009 (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 March 2, 2009 by motionman95 Link to comment Share on other sites More sharing options...
qazwsx Posted March 2, 2009 Share Posted March 2, 2009 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. Link to comment Share on other sites More sharing options...
AiQA Posted March 2, 2009 Author Share Posted March 2, 2009 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 More sharing options...
AiQA Posted March 2, 2009 Author Share Posted March 2, 2009 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 More sharing options...
AiQA Posted March 2, 2009 Author Share Posted March 2, 2009 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. Link to comment Share on other sites More sharing options...
Meg Posted July 13, 2018 Share Posted July 13, 2018 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 More sharing options...
Moderators JLogan3o13 Posted July 13, 2018 Moderators Share Posted July 13, 2018 @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. FrancescoDiMuro 1 "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 More sharing options...
Meg Posted July 13, 2018 Share Posted July 13, 2018 Yes I noticed that, I thought it might still get a response. I had to modify the code a bit so it will work with the new version. I will start a new thread. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now