Sign in to follow this  
Followers 0
iorgov

Help on script

5 posts in this topic

Hi all!

I'm newbie in autoit scripting and i was wondering can u good ppl give me a hand.

I am playing a game where u must use the right mouse button all the time. the problem is that my right mouse button skips. When i press and hold it it usually clicks a couple of times and it's not very pleasant.

I would really appreciate if someone helps me in writing a scrip where i can swap my right mouse button with some keyboard key (Shift for example), but the keyboard to work as a mouse button, I mean if I keep the shift key pressed the right mouse button responds as it is held down, and when I release the shift, the mouse button releases too.

Thanks in advance!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You will need to do a while loop with _IsPressed and MouseClick, MouseDown and MouseUp in it.

A starting example may be:

#include <Misc.au3>

$dll = DllOpen("user32.dll");needed to recognise hex keys, Example: 10 is Shift

While 1;endless loop until the script is open
    Select
        Case _IsPressed("10",$dll);if shift is pressed
            MouseClick("Right");then perform a right click
            Sleep(100);and wait 100 milliseconds
        EndSelect;add as many cases as u need to simulate right mouse click
Wend

It's very primitive but I hope u got the idea.

Edited by niubbone

Share this post


Link to post
Share on other sites

I posted in the wrong thread :mellow: I'll try again

Heres a way to get you started

HotKeySet("a", "_Toggle_RM_DU") ; set a hotkey

$bState = False ; Set state

While 1
    Sleep(100) ; loop to keep script alive
WEnd

Func _Toggle_RM_DU()
    $bState = Not $bState ;change the state
    If $bState Then ; check state is true
        MouseDown("right") ; right mouse down
    Else
        MouseUp("right") ; right mouse up
        $bState = False ; return state to false
    EndIf
EndFunc

There will be other swankier ways

Tip: pick a hotkey that your application does not use.


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

#4 ·  Posted (edited)

Or you could try enabling accessibly option 'mousekeys'.

Edited by omikron48

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  
Followers 0