Jump to content
Sign in to follow this  
Shasta

MouseMove or MouseClickDrag instant?

Recommended Posts

Shasta

Hello AutoITers,

I'm having a bit of an issue with either MouseMove or MouseClickDrag or both. This isn't my code but I do know how to write it. Putting 0 after the X and Y coords of either one of these commands should make the speed "instantaneous". Well I have seen other programs make mouse moves instant and the cursor could never been seen at any point but the origin and destination. When I use this code and watch the cursor it is not actually instant, as I can see the mouse at points along the line when I use it, like there is still some minor delay. If my syntax is wrong or I have left something out please let me know. I want this to be as fast as possible, and it isn't instant like it should be. Thank you for the help in advance.

#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=C:\Program Files\AutoIt3\Icons\Misc\bundle.ico
#AutoIt3Wrapper_outfile=.\DFLoot.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Comment=Darkfall Loot Macro
#AutoIt3Wrapper_Res_Description=Darkfall Loot Macro
#AutoIt3Wrapper_Res_Fileversion=1.0.2.4
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=© 2009
#AutoIt3Wrapper_Res_Language=1033
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.12.1
Author: Jazkal
Date: 03/12/2009
Script Function: Darkfall Loot Macro
#ce ----------------------------------------------------------------------------

Opt("MouseClickDownDelay", 0)
Opt("MouseClickDragDelay", 0); Alters the length of the brief pause at the start and end of a mouse drag operation.
Opt("MouseCoordMode", 0); Sets the way coords are used in the mouse functions, 0 = relative coords to the active window

If Not FileExists(@ScriptDir&"\_Macros.ini") Then
IniWrite(@ScriptDir&"\_Macros.ini", "Bag", "X", "0")
IniWrite(@ScriptDir&"\_Macros.ini", "Bag", "Y", "0")
Sleep(500)
EndIf

Global $BagTargetX = IniRead(@ScriptDir&"\_Macros.ini", "Bag", "X", "0")
Global $BagTargetY = IniRead(@ScriptDir&"\_Macros.ini", "Bag", "Y", "0")

HotKeySet("{TAB}", "_MouseDragDrop"); Press 'Esc' key once mouse if over loot you want to grab.
HotKeySet("!{`}", "_SetBagCoords"); Press 'Alt' 'Esc' to set the location of your bag, where you want to drag your loot too.

While 1
Sleep(10)
WEnd

Func _MouseDragDrop()
$MousePos = MouseGetPos()
MouseClickDrag("left", $MousePos[0], $MousePos[1], $BagTargetX, $BagTargetY, 0)
MouseMove($MousePos[0], $MousePos[1], 0)
EndFunc

Func _SetBagCoords()
$MousePos = MouseGetPos()
IniWrite(@ScriptDir&"\_Macros.ini", "Bag", "X", $MousePos[0])
IniWrite(@ScriptDir&"\_Macros.ini", "Bag", "Y", $MousePos[1])
$BagTargetX = $MousePos[0]
$BagTargetY = $MousePos[1]
EndFunc

Share this post


Link to post
Share on other sites
Yashied

Hello AutoITers,

I'm having a bit of an issue with either MouseMove or MouseClickDrag or both. This isn't my code but I do know how to write it. Putting 0 after the X and Y coords of either one of these commands should make the speed "instantaneous". Well I have seen other programs make mouse moves instant and the cursor could never been seen at any point but the origin and destination. When I use this code and watch the cursor it is not actually instant, as I can see the mouse at points along the line when I use it, like there is still some minor delay. If my syntax is wrong or I have left something out please let me know. I want this to be as fast as possible, and it isn't instant like it should be. Thank you for the help in advance.

Try follows.

Func _MouseDragDrop()
    $MousePos = MouseGetPos()
;   MouseClickDrag("left", $MousePos[0], $MousePos[1], $BagTargetX, $BagTargetY, 0)
    MouseDown("left")
    MouseMove($BagTargetX, $BagTargetY, 1)
    MouseUp("left")
    MouseMove($MousePos[0], $MousePos[1], 1)
EndFunc

EDIT: Good idea. So far, I tested your script, I removed all the unnecessary files on my desktop to the Trash.

^_^

Edited by Yashied

Share this post


Link to post
Share on other sites
Shasta

Wow nice job thats amazing. This is exactly what I wanted and it works perfect now. Thank you very much.

I don't know how much harder it is but how about a macro that clicks every pixel within a given/set range (like a square) and drags it to the given location.

In any case props to Yashied.

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  

×