Hold

Get help with using AutoHotkey and its commands and hotkeys
SonGokuBg
Posts: 38
Joined: 27 Aug 2017, 12:40

Hold

17 Apr 2019, 08:03

Hello,

Code: Select all

#NoEnv
#SingleInstance, force
SendMode, Input
#UseHook

CoordMode, Mouse, Screen

#If !mouseInRegion(719, 942, 1317, 1075)
LButton::RButton

LButton::
if (A_TickCount - RButton_Tick <= 350) AND (RButton_Tick >= 1)
Send {g}
else
{
Send {RButton down}
}
SetTimer, ClickBackUp, -1
RButton_Tick := A_TickCount


ClickBackUp:
if !(GetKeyState("RButton" , "P"))
Send {RButton up}
else
SetTimer, ClickBackUp, -1

mouseInRegion(x1, y1, x2, y2) {
MouseGetPos x, y
(x >= x1) && (x <= x2) && (y >= y1) && (y <= y2)
}
return
0::Suspend
Anyone can help me to make it when I hold LButton to hold RButton?
Last edited by SonGokuBg on 17 Apr 2019, 11:12, edited 1 time in total.
Rohwedder
Posts: 1734
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Hold

17 Apr 2019, 08:39

Hallo,
if you hold LButton, RButton will be held additionally.

Code: Select all

~LButton::RButton
SonGokuBg
Posts: 38
Joined: 27 Aug 2017, 12:40

Re: Hold

17 Apr 2019, 09:17

Rohwedder wrote:
17 Apr 2019, 08:39
Hallo,
if you hold LButton, RButton will be held additionally.

Code: Select all

~LButton::RButton
not work
Klarion
Posts: 127
Joined: 26 Mar 2019, 10:02

Re: Hold

17 Apr 2019, 10:17

works well
Rohwedder
Posts: 1734
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Hold

17 Apr 2019, 10:51

Hallo,
try this. All currently pressed keys and buttons are displayed. P: physical, L: logical only.

Code: Select all

#Persistent
#InstallKeybdHook
#InstallMouseHook
SetTimer, KeyCombination, 200
Return
~LButton::RButton

KeyCombination:
ToolTip, % KeyCombination()
Return
KeyCombination(ExcludeKeys:="")
{
    ExcludeKeys .= "{Shift}{Control}{Alt}{WheelUp}{WheelDown}"
    Loop, 0xFF
    {
        Key := Format("VK{:02X}",0x100-A_Index)
        IF !GetKeyState(Key)
            Continue
		Mode := GetKeyState(Key,"P")?"P":"L"			
        Key := Mode ":{" GetKeyName(Key) "}"
        If !InStr(ExcludeKeys,Key)
            KeyCombination .= Key
    }
    Return, KeyCombination
}
Return
SonGokuBg
Posts: 38
Joined: 27 Aug 2017, 12:40

Re: Hold

17 Apr 2019, 11:02

Rohwedder wrote:
17 Apr 2019, 10:51
Hallo,
try this. All currently pressed keys and buttons are displayed. P: physical, L: logical only.

Code: Select all

#Persistent
#InstallKeybdHook
#InstallMouseHook
SetTimer, KeyCombination, 200
Return
~LButton::RButton

KeyCombination:
ToolTip, % KeyCombination()
Return
KeyCombination(ExcludeKeys:="")
{
    ExcludeKeys .= "{Shift}{Control}{Alt}{WheelUp}{WheelDown}"
    Loop, 0xFF
    {
        Key := Format("VK{:02X}",0x100-A_Index)
        IF !GetKeyState(Key)
            Continue
		Mode := GetKeyState(Key,"P")?"P":"L"			
        Key := Mode ":{" GetKeyName(Key) "}"
        If !InStr(ExcludeKeys,Key)
            KeyCombination .= Key
    }
    Return, KeyCombination
}
Return
I am amateur :angel: Where should I insert this? What it do?
Rohwedder
Posts: 1734
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Hold

17 Apr 2019, 12:55

The line ~LButton::RButton is already included.
I wanted to show you, LButton and RButton are pressed with different modes.
LButton physical from you, RButton logical from Autohotkey.
Probably your target application does not accept logical mode.
SonGokuBg
Posts: 38
Joined: 27 Aug 2017, 12:40

Re: Hold

17 Apr 2019, 13:03

SonGokuBg wrote:
17 Apr 2019, 11:02
Rohwedder wrote:
17 Apr 2019, 10:51
Hallo,
try this. All currently pressed keys and buttons are displayed. P: physical, L: logical only.

Code: Select all

#Persistent
#InstallKeybdHook
#InstallMouseHook
SetTimer, KeyCombination, 200
Return
~LButton::RButton

KeyCombination:
ToolTip, % KeyCombination()
Return
KeyCombination(ExcludeKeys:="")
{
    ExcludeKeys .= "{Shift}{Control}{Alt}{WheelUp}{WheelDown}"
    Loop, 0xFF
    {
        Key := Format("VK{:02X}",0x100-A_Index)
        IF !GetKeyState(Key)
            Continue
		Mode := GetKeyState(Key,"P")?"P":"L"			
        Key := Mode ":{" GetKeyName(Key) "}"
        If !InStr(ExcludeKeys,Key)
            KeyCombination .= Key
    }
    Return, KeyCombination
}
Return
I am amateur :angel: Where should I insert this? What it do?
If I use ~LButton::RButton the "ignore in cordinates" not work
SonGokuBg
Posts: 38
Joined: 27 Aug 2017, 12:40

Re: Hold

17 Apr 2019, 13:04

Rohwedder wrote:
17 Apr 2019, 12:55
The line ~LButton::RButton is already included.
I wanted to show you, LButton and RButton are pressed with different modes.
LButton physical from you, RButton logical from Autohotkey.
Probably your target application does not accept logical mode.
If I use ~LButton::RButton the "ignore in cordinates" not work
SonGokuBg
Posts: 38
Joined: 27 Aug 2017, 12:40

Re: Hold

17 Apr 2019, 13:07

SonGokuBg wrote:
17 Apr 2019, 13:04
Rohwedder wrote:
17 Apr 2019, 12:55
The line ~LButton::RButton is already included.
I wanted to show you, LButton and RButton are pressed with different modes.
LButton physical from you, RButton logical from Autohotkey.
Probably your target application does not accept logical mode.
If I use ~LButton::RButton the "ignore in cordinates" not work
If I use this scripts separately everything is OK.

Code: Select all

CoordMode, Mouse, Screen

m::Suspend
#If !mouseInRegion(719, 942, 1317, 1075)
LButton::RButton


mouseInRegion(x1, y1, x2, y2) {
	MouseGetPos x, y
	return (x >= x1) && (x <= x2) && (y >= y1) && (y <= y2)
}

Code: Select all

#NoEnv
#SingleInstance, force
SendMode, Input
#UseHook

LButton::
if (A_TickCount - RButton_Tick <= 350) AND (RButton_Tick >= 1)
	Send {g}
else
{
	Send {RButton down}
}
SetTimer, ClickBackUp, -1
RButton_Tick := A_TickCount
return	

ClickBackUp:
if !(GetKeyState("RButton" , "P"))
	Send {RButton up}
else
	SetTimer, ClickBackUp, -1
return
Rohwedder
Posts: 1734
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Hold

18 Apr 2019, 01:17

Hallo,
your imprecise question:
Anyone can help me to make it when I hold LButton to hold RButton?
has at least two answers:
If you want to mask LButton:
LButton::RButton
If you don't:
~LButton::RButton
After the masking variant already appeared in your script, I assumed you needed the other one.
I will not relieve you of the job of correctly placing the correct variant!
SonGokuBg
Posts: 38
Joined: 27 Aug 2017, 12:40

Re: Hold

18 Apr 2019, 01:24

Rohwedder wrote:
18 Apr 2019, 01:17
Hallo,
your imprecise question:
Anyone can help me to make it when I hold LButton to hold RButton?
has at least two answers:
If you want to mask LButton:
LButton::RButton
If you don't:
~LButton::RButton
After the masking variant already appeared in your script, I assumed you needed the other one.
I will not relieve you of the job of correctly placing the correct variant!
The problem is both not work
SonGokuBg
Posts: 38
Joined: 27 Aug 2017, 12:40

Re: Hold

44 minutes ago

Rohwedder wrote:
18 Apr 2019, 01:17
Hallo,
your imprecise question:
Anyone can help me to make it when I hold LButton to hold RButton?
has at least two answers:
If you want to mask LButton:
LButton::RButton
If you don't:
~LButton::RButton
After the masking variant already appeared in your script, I assumed you needed the other one.
I will not relieve you of the job of correctly placing the correct variant!
I tried both

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], DataLife, Google [Bot], Odlanir, SonGokuBg, Tigerlily, vsub and 32 guests