ControlSend [Strg]+[Win]+[Numpad3] to OBS Studio - autohotkey

I try to send [Strg]+[Win]+[Numpad3] to OBS Studio to pause recording via an Autohotkey script.
My current approach is the following one because I want to avoid that other applications react on this shortcut. For example Notepad++ changes with this the open tabs.
ControlSend, , ^#{Numpad3}, ahk_class Qt5QWindowIcon
Actually, nothing happens in OBS Studio. Even when using {Ctrl down} and {LWin down} it does not work. Do you have an idea?

Use SetKeyDelay (or use separate up & down events with delay inbetween) to make the key be hold down for a bit longer.
Worked for me.
;hold down for 50ms
SetKeyDelay, -1, 50
ControlSend, , ^#{Numpad3}, ahk_class Qt5QWindowIcon

Related

I need to port an autohotkey script to autokey

I have been playing Stardew Valley and want to try animation canceling and found this script:
#IfWinActive Stardew Valley
x::
While GetKeyState("x","P")
{
sendEvent {LButton Down}
sleep 10
sendEvent {LButton Up}
sleep 125
sendEvent {r Down}{Delete Down}{RShift Down}
sleep 10
sendEvent {r Up}{Delete Up}{RShift Up}
}
sleep 30
return
The problem is that this is for AutoHotKey which is only for windows. I could try wine but I think I would then need a windows version of Stardew Valley which would require a windows version of Steam and wine probably doesn't have the files to allow for that. So instead I downloaded AutoKey which uses a very different language from AutoHotKey. The next issue is that I have not been able to find:
1.How to set click duration
2.How to set Keyboard press duration
3.How to specify what shift to use(It MUST use right shift to work)
4.How to make it repeat until I release the hotkey
If you can port it to AutoKey or recommend a different alternative then it would be appreciated.

Send function key stroke from AutoHotkey to OBS Studio

I am trying to send a keystroke to OBS Studio using AutoHotkey.
The code I am using is
DetectHiddenWindows, On
hWnd := WinExist("ahk_exe obs64.exe")
ControlSend,, {F5}, ahk_id %hWnd%
The function I want to trigger is "start recording"
Nothing is delivered. There is a rumour that the latest OBS does not allow for ControlSend. Is that true? How do I circumvent that?
Use SetKeyDelay (or separate up & down events with delay in between) to make the key be held down for a bit longer.
;hold down for 50ms
SetKeyDelay, -1, 50
ControlSend, , {F5}, ahk_exe obs64.exe
Also, assuming you don't need the hwnd for something else, there's no need to get it.
And it should work just fine as well without detecting hidden windows.

LButton Hotkey seems to prevent Send, {LButton}

I'm at a loss here. As soon as I add the LButton hotkey, the Send, {LButton} doesn't seem to work, but they show up in recently executed lines.
Env. Windows 7x64, Disabled Touchpad, AHK v1.1.31.01.
I try to emulate the Wink application (from DebugMode) to capture screenshots for training purposes. For that reason, I want to capture a screenshot just before a mouse click. This looks easy, and I even vaguely remember doing similar mouse hotkeys in the past. However I can't get this to work.
Step 1: I just reduced it to this simple script:
#InstallKeybdHook
#InstallMouseHook
#UseHook
#Persistent
Return
a::
Send, {LButton}
Return
q::
ExitApp
When using this script, I can simulate clicking the Left Mouse Button through the a key. Nothing special.
However as soon as I add either a line with "Hotkey, $LButton, MySendClick", or "$LButton::" the previously working a hotkey no longer works. In the recently executed lines, you can see the "Send, {LButton}" lines, but nothing is being send. Unexpectedly, the a hotkey actually causes the "$LButton::" hotkey to trigger (without it sending {LButton}). When I change the a hotkey to send "RButton" and the $LButton:: to $RButton::, then Send {Click} works perfectly (eventhough the a hotkey should never be able to trigger $RButton::).
Originally I just wanted to have the following HotKey:
$LButton::
SoundBeep, 300, 150 ; For testing only
; Send, ^{PrintScreen} ; To trigger Greenshot in the background
Sleep, 100
Send, {LButton}
Return
I upgraded from AHK v1.1.22.04 to v1.1.31.01. No improvement.
I tried "Click", "sendInput, {LButton}", "Send {Click}", "MouseClick, Left".
I tried "$LButton::", "vk01sc000::", "Hotkey, $LButton, MyClick".
Is this an issue with my specific Windows 7 configuration or an "undocumented AHK feature"?
#InstallKeybdHook
#InstallMouseHook
#UseHook
#Persistent
Return
a::
Send, {LButton}
Return
$LButton::
SoundBeep, 300, 150 ; Should be Send, ^{PrintScreen} ; To trigger Greenshot in the background
MouseClick, Left
Return
q::
ExitApp
In this last test example, When $LButton:: is disabled, the a hotkey works like a charm, but as soon as I enable $LButton::, the a hotkey triggers $LButton:: and no mouse click is being sent to the windows applications.
I would appreciate it when other Windows 7 users could quickly test this issue.
In my experience, using keys that you still want the input to pass through need the Tilde prefix.
https://www.autohotkey.com/docs/Hotkeys.htm#Tilde
~LButton::
SoundBeep, 300, 150 ; Should be Send, ^{PrintScreen} ; To trigger Greenshot in the background
KeyWait, LButton ; Wait for lbutton to be released.
Return

AutoHotKey overwriting SurfacePen not working

I want to overwrite my "rubber" button on the Surface Pen with AutoHotKey. My aim is to click my PDF presentation (Left and Right Arrow) with the SurfacePen
Described on many Websites:
https://www.reddit.com/r/Surface/comments/3rftuo/autohotkey_tip_f20_maps_the_single_click_f19_maps/
https://www.wpxbox.com/how-to-remap-surface-pen-button-actions/
I have already tried to use other keys like F1 to get the desired reaction and this is working. Just the keys #F18, #F19 and #F20 (for the rubber button) don't seem to work.
#F19:: Send, {Left}
#F20:: Send, {Right}
Thanks
It worked out this way. I am using FoxitReader as PDF Reader
#IfWinActive, ahk_exe FoxitReader.exe
#F18:: Send, {Left}
#F20:: Send, {Right}

Consume Windows key release in autohotkey script

I'd like to map the Windows 10 virtual desktop switching feature to Windows key + mouse wheel with autohotkey.
My script looks like this:
LWin & WheelUp::Send ^#{Left}
LWin & WheelDown::Send ^#{Right}
The desktop switching works flawlessly, I can even hold down the Windows key and scroll up and down and it will change back and forth between desktops.
Unfortunately, if I keep holding down the Windows key for a little while after the last wheel action, the key release is sent to the OS which opens the start menu. Also, when I close the start menu afterwards (by pressing the windows key again) it switches back to the first virtual desktop I changed to (as if it had only received one "switch desktop" command).
So, my question is: how can I consume this key release in my script (and only for these two commands)?
Thanks in advance.
Try this .
LWin & WheelUp::
Send, {Ctrl Down}{LWin Down}{Left}
SetTimer ReleaseKeys, 50
return
LWin & WheelDown::
Send, {Ctrl Down}{LWin Down}{Right}
SetTimer ReleaseKeys, 50
return
ReleaseKeys:
If not GetKeyState("LWin","P")
{
SetTimer ReleaseKeys, off
Send {Blind}{Ctrl Up}
Send {Blind}{LWin Up}
WinClose Start ahk_class Windows.UI.Core.CoreWindow
}
return