Jump to content

Click and drag on command


tammelol
 Share

Recommended Posts

Hello, i'm totally new to scripting. I'd only like to get a script done which will drag and drop x,y to x,y on my command when pressing numpad keys (8,4,5,6). And so it wouldn't just complete the loop and close. I want it to be open and available whenever i press any of the numpad keys.

Can someone guide me through this process, so far i've managed to make it drag and drop but i don't know how to apply a faster speed or how to assign it on a specific button command.

Or if someone has too much free time would be willing to make this script for me :D

Kind Regards, tammelol

Edited by tammelol
Link to comment
Share on other sites

There are many tutorial options to choose from. Go to Youtube.com and search keyword 'AutoIt Tutorial' a slew of options will appear for you. You use the same keyword and search the forums here, and you will also find multiple options.

Once you have a basic understanding of AutoIt, then lookup these following functions. They will give you a head start towards what you ask.

HotKeySet() ;Use this to set your Hotkeys (8,4,5,6)

MouseClickDrag() ; There is a parameter for setting the speed at which the mouse will move.

Now, after writing your first script, and you still having problems with it. Provide your script here, or at least show an example of it, and more ppl will be willing to respond and help you.

Asking for someone to make your script for you, is not going to work, there are freelance scripting sites that will cover those services.

Good Luck & Hope to see you around :D

Realm

Edit: btw, Welcome to the AutoIt Forums :oops:

Edited by Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

Thanks for reply and yes, i knew asking to someone to make a script for me is just... well stupid. Well, anyway this is what i have so far ( i decided to go with arrow keys ) but i keep getting error with HotKeySet command. However i managed to make it endless sleep. Perhaps someone can tell me what i am doing wrong.

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage")  ;Shift-Alt-d
HotKeySet ( "{RIGHT}", "MouseClickDrag({left}, 400, 500, 500, 500")
While 1
    Sleep(100)
WEnd
;;;;;;;;
Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc
Func Terminate()
    Exit 0
EndFunc
Func ShowMessage()
    MsgBox(4096,"","This is a message.")
EndFunc

It's the part with the HotKeySet RIGHT

EDIT: I managed to make it endless sleep and do the right drag but it occurs right away and not on my command

i changed the line to

HotKeySet ( "{RIGHT}", MouseClickDrag("left", 400, 500, 500, 500))
Edited by tammelol
Link to comment
Share on other sites

tammelol,

The syntax is wrong...should be

HotKeySet("{RIGHT}", MouseClickDrag("left", 400, 500, 500, 500))

However, when I run this it immediatley executes the mousedrag and then loops.

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

Well i got it working like this

HotKeySet("{RIGHT}", "_Site1")
HotKeySet("{LEFT}", "_Site2")
HotKeySet("{UP}", "_Site3")
HotKeySet("{DOWN}", "_Site4")
Func _Site1()
MouseClickDrag("left", 400, 500, 500, 500, 3)
EndFunc ;==> _Site1
Func _Site2()
MouseClickDrag("left", 400, 500, 300, 500, 3)
EndFunc ;==> _Site2
Func _Site3()
MouseClickDrag("left", 400, 500, 400, 400, 3)
EndFunc ;==> _Site3
Func _Site4()
MouseClickDrag("left", 400, 500, 400, 600, 3)
EndFunc ;==> _Site4

But it's reactions are like really slow, the mouse is instantly in place yes but it takes like half a second to start dragging which is too long, i need it to start dragging immediately when i click.

Edited by tammelol
Link to comment
Share on other sites

tammelol,

Perhaps hotkeyset is not your best option. Can you explain exactly what you are trying to do. Also, consider the fllowing code:

#include <misc.au3>
Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d
While 1
Sleep(100)
if _ispressed("02") then MouseClickDrag("left", 400, 500, 500, 500)
WEnd
;;;;;;;;
Func TogglePause()
$Paused = NOT $Paused
While $Paused
sleep(100)
ToolTip('Script is "Paused"',0,0)
WEnd
ToolTip("")
EndFunc
Func Terminate()
Exit 0
EndFunc
Func ShowMessage()
MsgBox(4096,"","This is a message.")
EndFunc

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

kylomas,

Well to put it simply, it's kind of a rhytm game, where arrows come and at the right time you need to drag a thingie in the direction the arrow is showing, as the tempo keeps increasing, it's difficult to control it with mouse, so i want to try this with keyboard controls, so plainly i need it to react as fast or faster than conventional mouse control. I know it sounds like a bunch of nonsense but it means a lot to me.

I tried your script but no known button on the keyboard sets off the command

MouseClickDrag("left", 400, 500, 500, 500)
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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