Auio42TheWin

Making your own mouse move? (confusing)

27 posts in this topic

#1 ·  Posted (edited)

Hi, I've asked this in the past and I didn't really get the answers I was looking for; to the point that someone said I was just begging for code. 
That was not my intention, and I am sorry, but I have little to no math skills.
I just want to see how one would "make there own mousemove(x,y)" with a function that doesn't move your mouse to specific coordinates, but just nudges it a bit from it's current position, like this : 
 

Func _MouseMoveRelative ($iX, $iY)
    RegWrite("HKEY_CURRENT_USER\Control Panel\Mouse","MouseSpeed","REG_SZ",0)
    RegWrite("HKEY_CURRENT_USER\Control Panel\Mouse","MouseSensitivity","REG_SZ",10)
    Local Const $MOUSEEVENTF_MOVE = 0x01
    DllCall ("user32.dll", "int", "mouse_event", _
            "int", $MOUSEEVENTF_MOVE, _
            "int", $iX, _
            "int", $iY, _
            "int", 0, _
            "int", 0)
    RegWrite("HKEY_CURRENT_USER\Control Panel\Mouse","MouseSpeed","REG_SZ",1)
    RegWrite("HKEY_CURRENT_USER\Control Panel\Mouse","MouseSensitivity","REG_SZ",20)
EndFunc

I have personally been browsing the autoit forums and using Scite to accomplish, and experiment with a ton of different things for fun.
 
I really wish I could know how to do this, so then I could use whatever method to help me in the long run. 
Thanks, 
 

Also, does the current mousemove(x,y) in autoit use something like this as an internal function? Moving the mouse relative to get to an absolute position?
#loveautoit

Edited by Auio42TheWin
Added code tags

Share this post


Link to post
Share on other sites



Auio42TheWin,

When you post code please use Code tags - see here how to do it. Then you get automatic syntax colouring as you can see above now I have added the tags (and removed all the color/font BB codes.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Auio42TheWin,

When you post code please use Code tags - see here how to do it. Then you get automatic syntax colouring as you can see above now I have added the tags (and removed all the color/font BB codes.

M23

Thanks =)

Share this post


Link to post
Share on other sites

Auio42TheWin,

And when you reply, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - I know what I wrote and it just pads the thread unnecessarily.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Alright =o.

But like, only if there is only one dude commenting in the thread;  right?

Share this post


Link to post
Share on other sites

Auio42TheWin,

 

But only if there is only one dude commenting in the thread?

All I ask is that you do not post walls of quotes. And as you can see from what I did above, you can very easily edit a quote and leave just what is necessary if you really feel the need to do so.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

So you want to move the mouse relatively to its current position?

If I understood well, would this be what you want?

_MouseMoveRelative(-50, 100)


Func _MouseMoveRelative($iX, $iY, $iSpeed = 10)
    ; getting current mouse position
    $currentX = MouseGetPos(0)
    $currentY = MouseGetPos(1)

    Return MouseMove($currentX+$iX, $currentY+$iY, $iSpeed)
EndFunc

My stuff

Spoiler

My UDFs  _AuThread multithreading emulation for AutoIt · _ExtInputBox an inputbox with multiple inputs and more features · forceUTF8 fix strings encoding without knowing its original charset · JSONgen JSON generator · _TCPServer UDF multi-client and multi-task (run on background) event-based TCP server easy to do · _TCPClient_UDF multi-server and multi-task (runs on background) event-based TCP client easy to do · ParseURL and ParseStr functions ported from PHP · _CmdLine UDF easily parse command line parameters, keys or flags · AutoPHP Create documents (bills, incomes) from HTML by sending variables/arrays from AutoIt to PHP · (Un)Serialize Convert arrays and data into a storable string (PHP compatible) · RTTL Plays and exports to MP3 Nokia-format monophonic ringtones (for very old cellphones) · I18n library Simple and easy to use localization library · Scripting.Dictionary OOP and OOP-like approach · Buffer/stack limit arrays to N items by removing the last one once the limit is reached · NGBioAPI UDF to work with Nitgen fingerprint readers · Serial/Licensing system require license key based on unique machine ID from your users · HTTP a simple WinHTTP library that allows GET, POST and file uploads · Thread true AutoIt threads (under-dev) Classes _WKHtmlToX uses wkhtmlto* to convert HTML files and webpages into PDF or images (jpg, bmp, gif, png...) Snippets _Word_DocFindReplaceByLongText replace strings using Word UDF with strings longer than 255 characters (MSWord limit) rangeparser parser for printing-like pages interval (e.g.: "1,2,3-5") EnvParser parse strings/paths with environment variables and get full path Random stuff Super Mario beep sound your ears will hurt

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

@

 

So you want to move the mouse relatively to its current position?

If I understood well, would this be what you want?

_MouseMoveRelative(-50, 100)


Func _MouseMoveRelative($iX, $iY, $iSpeed = 10)
    ; getting current mouse position
    $currentX = MouseGetPos(0)
    $currentY = MouseGetPos(1)

    Return MouseMove($currentX+$iX, $currentY+$iY, $iSpeed)
EndFunc

/going to assume i can quote now so this guy knows i'm talking to him

Thanks man! but it's not really what i meant :c

How would one manipulate this : 

Func _MouseMoveRelative ($iX, $iY)
    RegWrite("HKEY_CURRENT_USER\Control Panel\Mouse","MouseSpeed","REG_SZ",0)
    RegWrite("HKEY_CURRENT_USER\Control Panel\Mouse","MouseSensitivity","REG_SZ",10)
    Local Const $MOUSEEVENTF_MOVE = 0x01
    DllCall ("user32.dll", "int", "mouse_event", _
            "int", $MOUSEEVENTF_MOVE, _
            "int", $iX, _
            "int", $iY, _
            "int", 0, _
            "int", 0)
    RegWrite("HKEY_CURRENT_USER\Control Panel\Mouse","MouseSpeed","REG_SZ",1)
    RegWrite("HKEY_CURRENT_USER\Control Panel\Mouse","MouseSensitivity","REG_SZ",20)
EndFunc

to move to a position on the screen? Sorry for being confusing.

Sort of like the above function, but by moving relative in different directions until it meets the coord I want to go to.

Edited by Auio42TheWin

Share this post


Link to post
Share on other sites

#bump

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

@

/going to assume i can quote now so this guy knows i'm talking to him

Thanks man! but it's not really what i meant :c

to move to a position on the screen? Sorry for being confusing.

Sort of like the above function, but by moving relative in different directions until it meets the coord I want to go to.

What you ask for is what that code does.

If not, explain in detail why it is not.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

If you do not understand the answer provided - we suggest you get the basics down to coding. There is no point in you fumbling around and not even understand what is being told to you. Saying that, we have a class you can take:

'?do=embed' frameborder='0' data-embedContent>>

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

If you do not understand the answer provided - we suggest you get the basics down to coding. There is no point in you fumbling around and not even understand what is being told to you. Saying that, we have a class you can take:

'?do=embed' frameborder='0' data-embedContent>>

 

What you ask for is what that code does.

If not, explain in detail why it is not.

For example, let's say there are 20*20 pixel wall and a 1 pixel coin. 

I want to move the coin to a certain pixel on the wall (5,7) for example, but it can only be done by going up or down relatively a certain amount, and starting where I actually am.

Edited by Auio42TheWin

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

OK, just as I thought.

The code that Jefrey provided does exactly that.

No, that's not what the code does. 

It moves the mouse relative only, what I am asking for is.... sort of like pathfinding. It's hard to explain, but I've seriously tried everything here.

Just thought of an example. You know how in those olden games somehow the programmers would make it so the npcs would increase their x or y value until they get to your x or y value? And they do this by increasing numbers relative to where they are? That's the only example I can think of, but I'm curious about doing something like that with the mouse. Curious if an operation like this is the same way Mousemove(x,y) in autoit is made, you see?

OR for another example,  (something on your screen, random location) could increase or decrease its x or y coordinates multiple times to go to your mouse. 

Edited by Auio42TheWin

Share this post


Link to post
Share on other sites

Auio42TheWin,

What exactly is the point of all this? Is it just pure curiosity on your part or do you have a particular reason why you want to move the mouse in this manner?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

 

I said in my post, "I really wish I could know how to do this, so then I could use whatever method to help me in the long run."

if you want some examples I could tell you some.

there have been several times throughout my years of using scite that I couldn't accomplish something (for looks) just because I had no idea how something like this would be done. This could be applied to sliding a GUI element on a scite created GUI to another element that is in motion, or if I want have a cool mouse effect. 

I have done much research on trying to figure out how something like this could be accomplished, but I just get 0 search terms for it... I came to you guys as a last resort for some information. 
I love Autoit for it's simplicity in syntax, but I love to know how to do certain things with its undying potential. 
If this is too hard, or would take too much time (too difficult) I am sorry. 
Is something like this not possible without advance mathematical equations?
/edit sorry for quoting you again, i forgot. 
/edit2 dude how are your post counts not like in the 100k? i've seen you around the general help so much.
Edited by Auio42TheWin

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Auio42TheWin,

 

I love Autoit for it's simplicity in syntax

So why try and over-complicate thing by using the registry and DLLCall?

Please give me a concrete example or I am going to assume that you are like everyone else who posts here seeking "a new way to move the mouse" - and we all know why they want to do that.

M23

Edited by Melba23
Spellnig

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

From the earlier post he has made and how he is talking - I will bet he has a script someone gave him and he wants to make it work for his needs. I will also bet we know WHY he needs it.

 

@ Auio42TheWin

I have little reason to think this is not for a game. If it isn't, then explain the app you will be using it for. If it is - then just say so and the moderator will be very helpful in pointing out the forum rules that says

Quoted from Forum rules:

1. Do not ask for help with AutoIt scripts, post links to, or start discussion topics on the following subjects:

  • Launching, automation or script interaction with games or game servers, regardless of the game.
and then our wonderful moderator will lock the thread.

-------------

Any discussion on automating a game is a non-starter here. Don't ask, don't say it doesn't apply to you, just don't. period. All you will be doing is wasting people's time and irritating a moderator.

Now if this is NOT for a game - we can help you. It would be great to know the name of the application at this point for odds are someone has already done what you want and that will save you time.

Edited by Bert

Share this post


Link to post
Share on other sites

From the earlier post he has made and how he is talking - I will bet he has a script someone gave him and he wants to make it work for his needs. I will also bet we know WHY he needs it.

 

@ Auio42TheWin

I have little reason to think this is not for a game. If it isn't, then explain the app you will be using it for. If it is - then just say so and the moderator will be very helpful in pointing out the forum rules that says

and then our wonderful moderator will lock the thread.

-------------

Any discussion on automating a game is a non-starter here. Don't ask, don't say it doesn't apply to you, just don't. period. All you will be doing is wasting people's time and irritating a moderator.

Now if this is NOT for a game - we can help you. It would be great to know the name of the application at this point for odds are someone has already done what you want and that will save you time.

How is this for a game? 

I simply mentioned an example of pathfinding, hoping someone here could help me.

I quote from the forum rules, 

"1. Do not ask for help with AutoIt scripts, post links to, or start discussion topics on the following subjects:

Launching, automation or script interaction with games or game servers, regardless of the game."

 

I am not , and never said I was aiming for this.

Please tell me how automatically labeling a concept that could and is applied is many things as cheating? 

 

Honestly, I don't understand. 

@Melba -- the reason I am using DLLCall to move the mouse relative is because it is a way to move the mouse relatively, I don't care if you accomplish this "pathfinding" using Mousemove(x,y).

The reason I provided the function that moves the mouse relatively is because I thought that would be the basis for what I am trying to accomplish.

 

i'm just going to check another forum.

Share this post


Link to post
Share on other sites

Auio42TheWin,

You have already been given a perfectly serviceable function to move the mouse "relatively" (whatever that really means) using standard AutoIt commands in post #7 - so why are you still insisting on using the more complex DLLCall code? As both I and Bert have suggested (with very differing degrees of diplomacy) the main reason we see such insistence on not using MouseMove is because a game is detecting and blocking that function in a gamebot script. That is why I asked for a concrete example where you cannot use MouseMove - which you still have not produced. If it is for some big secret project that you do not want to disclose in open forum, by all means send me a PM explaining why you need to use DLLCall instead.

Of course if we have entirely misunderstood your request, then please explain it in more detail - but your explanation in post #12 of what you wanted has, as JohnOne pointed out, already been provided in the response at post #7.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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