how can i send mouse rawinput ?

Ask gaming related questions
ginzu
Posts: 5
Joined: 27 Jul 2020, 08:41

how can i send mouse rawinput ?

27 Jul 2020, 08:55

Hello,

i am not an experienced user in ahk scripts.

Before signing up my account here and asking for help, i hugely googled the internet but i never found what i am looking for anywhere.

english is not my native language too, so, i am sorry if my english is not perfect.

I would like to create a script when i click on a left mouse button, it send rawinput left button click like an autofire.

I already figured out how to send autofire left click (logical) but when i want to play games that handle only rawinput, my script doesn't work!

i tried SendRaw, and also {Raw}[LButton} but it's a no go!


here my latest test :

Code: Select all

lbutton::
	while (getKeyState("lbutton", "P"))
	{
		SendRaw {lbutton}
	}
return

how can i send leftbutton in rawinput ? does it's possible?

thanks!
MrDoge
Posts: 41
Joined: 27 Apr 2020, 21:29

Re: how can i send mouse rawinput ?

27 Jul 2020, 10:08

important to read the comments in script

f3 to exitApp

do you know how to get the name of the program ? example: program.exe,
to tell ahk it's an exe : you'll have to precede it with ahk_exe so :
ahk_exe program.exe

difference between the two (both work but just in case) :
$lbutton::
and
~lbutton::

Code: Select all

#SingleInstance, force
#MaxThreadsPerHotkey 3
 
SendMouse_LeftClick(duration=100) { ; send fast left mouse clicks
;---------------------------------------------------------------------------
    DllCall("mouse_event", "UInt", 0x02) ; left button down
    DllCall("mouse_event", "UInt", 0x04) ; left button up
}


f3::ExitApp
#if (running=False) ; and WinActive("ahk_exe program.exe")  ;if you want to be only for a certain program

$lbutton::
if getKeyState("lbutton", "P")
{
    running:=true
    while getKeyState("lbutton", "P")
    {
        Random, OutputVar , 50, 100   ;random delay from 50 to 100 milliseconds  ; you can reduce this too ;
		SendMouse_LeftClick(100)    ;reduce 100 to whatever you want 
        ;SendMouse_RelativeMove(10,0)   
        sleep OutputVar  ;you can remove the Random, OutputVar , 50, 100 and sleep the time you want
    }
    running:=false
}

Code: Select all

#SingleInstance, force
#MaxThreadsPerHotkey 3
 
SendMouse_LeftClick(duration=100) { ; send fast left mouse clicks
;---------------------------------------------------------------------------
    DllCall("mouse_event", "UInt", 0x02) ; left button down
    DllCall("mouse_event", "UInt", 0x04) ; left button up
}


f3::ExitApp
#if (running=False) ; and WinActive("ahk_exe program.exe")  ;if you want to be only for a certain program

~lbutton::
if getKeyState("lbutton", "P")
{
    running:=true
    while getKeyState("lbutton", "P")
    {
        Random, OutputVar , 50, 100   ;random delay from 50 to 100 milliseconds  ; you can reduce this too ;
		SendMouse_LeftClick(100)    ;reduce 100 to whatever you want 
        ;SendMouse_RelativeMove(10,0)   
        sleep OutputVar  ;you can remove the Random, OutputVar , 50, 100 and sleep the time you want
    }
    running:=false
}
ginzu
Posts: 5
Joined: 27 Jul 2020, 08:41

Re: how can i send mouse rawinput ?

27 Jul 2020, 13:12

Hi,

thank you for replying me so fast,

i have quickly tried to use your script coding with my program.

It's the sega emulator model 3 (supermodel.exe)

what i am trying to do is having an autofire feature when i click on my mouse (left button).

the Emulator is launched with a command that gives it data using rawinput.

I tried with your code but it doesn't work at the moment.

I also begin to simplify your code like that :

Code: Select all

#SingleInstance, force
#MaxThreadsPerHotkey 3
 
SendMouse_LeftClick(duration=100) { ; send fast left mouse clicks
;---------------------------------------------------------------------------
    DllCall("mouse_event", "UInt", 0x02) ; left button down
    DllCall("mouse_event", "UInt", 0x04) ; left button up
}


Escape::ExitApp
;#if (running=False) ; and WinActive("ahk_exe Supermodel.exe")  ;if you want to be only for a certain program

$lbutton::
if getKeyState("lbutton", "P")
{
    ;running:=true
    while getKeyState("lbutton", "P")
    {
        ;Random, OutputVar , 50, 100   ;random delay from 50 to 100 milliseconds  ; you can reduce this too ;
		SendMouse_LeftClick(100)    ;reduce 100 to whatever you want 
        ;SendMouse_RelativeMove(10,0)   
        ;sleep OutputVar  ;you can remove the Random, OutputVar , 50, 100 and sleep the time you want
    }
    ;running:=false
}
but even with that, it is not working....
I am wondering why it's not working.

i verified that the ahk script is running fine in the background and it is.

Do you have an other idea to help me going further ?

thank you
MrDoge
Posts: 41
Joined: 27 Apr 2020, 21:29

Re: how can i send mouse rawinput ?

27 Jul 2020, 13:36

oof I think I've made a mistake when copy pasting the code here
forgot running:=false at the top

replace with this line if you want
#if (running=False) and WinActive("ahk_exe Supermodel.exe") ;if you want to be only for a certain program

Code: Select all

#SingleInstance, force
#MaxThreadsPerHotkey 3
running:=false

SendMouse_LeftClick(duration=100) { ; send fast left mouse clicks
;---------------------------------------------------------------------------
    DllCall("mouse_event", "UInt", 0x02) ; left button down
    sleep, duration
    DllCall("mouse_event", "UInt", 0x04) ; left button up
}


f3::ExitApp
#if (running=False) ; and WinActive("ahk_exe program.exe")  ;if you want to be only for a certain program

$lbutton::
if getKeyState("lbutton", "P")
{
    running:=true
    while getKeyState("lbutton", "P")
    {
        Random, OutputVar , 50, 100   ;random delay from 50 to 100 milliseconds  ; you can reduce this too ;
		SendMouse_LeftClick(100)    ;reduce 100 to whatever you want 
        ;SendMouse_RelativeMove(10,0)   
        sleep OutputVar  ;you can remove the Random, OutputVar , 50, 100 and sleep the time you want
    }
    running:=false
}


and simpler

Code: Select all

#SingleInstance, force
#MaxThreadsPerHotkey 3
running:=false

SendMouse_LeftClick() { ; send fast left mouse clicks
;---------------------------------------------------------------------------
    DllCall("mouse_event", "UInt", 0x02) ; left button down
    DllCall("mouse_event", "UInt", 0x04) ; left button up
}


f3::ExitApp
#if (running=False) ; and WinActive("ahk_exe program.exe")  ;if you want to be only for a certain program

$lbutton::
if getKeyState("lbutton", "P")
{
    running:=true
    while getKeyState("lbutton", "P")
    {
		SendMouse_LeftClick()    ;reduce 100 to whatever you want 
        sleep, 10  ;you can remove the Random, OutputVar , 50, 100 and sleep the time you want
    }
    running:=false
}
ginzu
Posts: 5
Joined: 27 Jul 2020, 08:41

Re: how can i send mouse rawinput ?

28 Jul 2020, 02:31

Thanks for your help MrDoge,

I tried the last code you sent me but the autofire never happened .

i saw the script is running and i haven't any message box (it run well in the background) but it's like that doesn't hook or haven't any effect on it....

I don't have any idea now on how to put this fabulous feature in place.

:eh:
ginzu
Posts: 5
Joined: 27 Jul 2020, 08:41

Re: how can i send mouse rawinput ?

28 Jul 2020, 17:23

Is there a method to understand why it doesn't hook with the application?
Because, the code is working outside of the program (Supermodel.exe) .. What can prevent the code of the ahk script from working in the application?
ginzu
Posts: 5
Joined: 27 Jul 2020, 08:41

Re: how can i send mouse rawinput ?

14 Sep 2020, 13:16

+1
I am wondering why all command i send from an ahk are not working when my emulator is launched....

Maybe @evilC is able to understand what's going on.

It's been a while since i don't try anything regarding the evolution of this thread. but because i would try to send another key sequence to this emulator using an ahk, i noticed that whatever i send, nothing is happening when the program (Supermodel.exe) is running.

It's really like we can't reach the program whith the Ahk script ?

Any idea would be apreciated! thanks. ;)
MrDoge
Posts: 41
Joined: 27 Apr 2020, 21:29

Re: how can i send mouse rawinput ?

14 Sep 2020, 13:52

all command don't work ?
try to run the ahk script as admin

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 17 guests