Question / Help Numeric hotkeys not working on Windows OBS studio

Naweo

New Member
Hello!

I was only able to find this problem in the MAC forums, but I have the same problem with windows.

Numeric hotkeys do not work while OBS studio is not active.

Is there a fix to this?

Thanks! =)
 

Naweo

New Member
Scene switches, though I would like to note that I am using a keyboard without a numeric pad so I am using a autohotkey script to execute those keyinputs, I will try testing a different input method and see if that works, could be that OBS studio does not register such key inputs from the script I have running. If I use any hotkey that my keyboard actually has physically then it works.

If that does not work I will get back to you with a log.
 

Suslik V

Active Member
So, you cannot setup hotkey at Settings>Hotkeys ?
Also, try to run autohotkey with admin rights too.
 

Naweo

New Member
Well I can make the hotkeys, but they do not seem to work, even when Autohotkey is run as administrator hmm
 

Suslik V

Active Member
So strange, I can trigger any action in OBS Studio even using on-screen keyboard. Post a log where you are switching scenes and it doesn't work.
 

Naweo

New Member
Alright, uploaded a log file. It simply does not register my input at the end. Please let me know if you find anything, I appreciate it.

On-screen keyboard works for me too, but I am trying to use Autohotkey to send keystrokes automatically, though I am not sure which input to use to make it work with OBS studio, provided that it is possible.
 

Attachments

  • 2016-09-13.txt
    50.8 KB · Views: 96

Naweo

New Member
Sure, I will make a simpler version as the one I have now is quite heavy, give me 2 mins please

"
; // OPEN BROADCASTER SOFTWARE AUTO SCENE SWITCHER

#SingleInstance force
#Persistent
#NoEnv
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
#MaxThreadsPerHotkey 2
detectHiddenWindows, on
ListLines Off
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1


~f8::
send, {NumPad1}
return

~f7::
send, {NumPad9}
return

"

- It did not want to let me upload, so here is the short version. Basically just make two hotkeys for NUM1 and NUM9 and see if you can make it register with autohotkey.
 

Suslik V

Active Member
I don't like few parameters from your script (HotkeyInterval and MaxHotkeysPerInterval values for example) but
let's test it like this:

Code:
Send, {Numpad1 Down}
Sleep, 10 ; pause 10ms to allow application to recognize the pressed state
Send, {Numpad1 Up}

or "compile" this scripts with AutoHotkey (make exe):
Code:
; OBS Studio existing keys test (Studio v0.15.4, ahk v1.0.47.3)

; Start loop as auto-execute, loop until ScrollLock is pressed!!!
; Infinite loop!!! Simulates f3, f6 keypress at ~3 sec intervals

Loop {

Send, {F3 Down}
Sleep, 10 ; pause 10ms to allow application to recognize the pressed state
Send, {F3 Up}

Sleep, 3000

Send, {F6 Down}
Sleep, 10 ; pause 10ms to allow application to recognize the pressed state
Send, {F6 Up}

Sleep, 3000
}

;;;;;;;;;;;;;;;;;;;;;;;;;

; Pause timers and loops on ScrollLock press.
ScrollLock::
{
Pause
}
return
Code:
; OBS Studio non-existing keys test (Studio v0.15.4, ahk v1.0.47.3)

; Start loop as auto-execute, loop until ScrollLock is pressed!!!
; Infinite loop!!! Simulates f13, f16 keypress at ~3 sec intervals

Loop {

Send, {F13 Down}
Sleep, 10 ; pause 10ms to allow application to recognize the pressed state
Send, {F13 Up}

Sleep, 3000

Send, {F16 Down}
Sleep, 10 ; pause 10ms to allow application to recognize the pressed state
Send, {F16 Up}

Sleep, 3000
}

;;;;;;;;;;;;;;;;;;;;;;;;;

; Pause timers and loops on ScrollLock press.
ScrollLock::
{
Pause
}
return
Code:
; OBS Studio existing keys test, advanced scripting with timer loops (Studio v0.15.4, ahk v1.0.47.3)

; Start loop as auto-execute, loop until ScrollLock is pressed!!!
; Infinite loop!!! Simulates any statement check each 10ms
SetTimer, Label_1, 10 ; execute subrutine at label_1 each 10ms

; No more auto-executed strings (after first "return" word).

return

;;;;;;;;;;;;;;;;;;;;;;;;;

; my subroutine, checks the state of the f2 key and returns to the loop (timer at 10ms where it called from)
Label_1:
if GetKeyState("F2") ; or any 'your' event is true then go to Label_2
  Gosub, Label_2
return

;;;;;;;;;;;;;;;;;;;;;;;;;

; my subroutine, trigger f3 key and returns to the loop (where it called from by f2 key press)
Label_2:
Sleep, 30 ; wait for 30ms before trigger next key

Send, {F3 Down}
Sleep, 10 ; pause 10ms to allow application to recognize the pressed state
Send, {F3 Up}

return

;;;;;;;;;;;;;;;;;;;;;;;;;

; Let's program the script suspend by ScrollLock press,
; (for easy script termination when important keys in use).
; Pause timers and loops too.
ScrollLock::
{
Suspend
Pause
}
return

;;;;;;;;;;;;;;;;;;;;;;;;;

; turn f5 to f6 key (f5 excluded, remap)
F5::F6

; trigger f7 key each time I press Right Mouse Button, while keep Right Mouse Button func.
~RButton::F7

; turn f8 into NumPad 1 (f8 excluded, remap)
F8::Numpad1

;;;;;;;;;;;;;;;;;;;;;;;;;

; we will loop until f4 is pressed,
F4::My_variable_to_exit_the_loop:=true

; Start loop by f1 key, triggers non existing f9, f10 keys in ~3 sec intervals
F1::
{
My_variable_to_exit_the_loop:=fasle ; we wait for F4
SetTimer, Label_3, 6000
; it is almost impossible to press key f1 and f4 so fast to rise cancel but for other logic it's normal, so you can insert "if->return" there too

Send, {F9 Down} ; execute at least once
Sleep, 10 ; pause 10ms to allow application to recognize the pressed state
Send, {F9 Up}

Sleep 3000 ; pause
SetTimer, Label_4, 6000
if My_variable_to_exit_the_loop
  return ; there was delay after key f1 press, so f4 could cancel all the actions

Send, {F10 Down} ; execute at least once
Sleep, 10 ; pause 10ms to allow application to recognize the pressed state
Send, {F10 Up}

}
return

;;;;;;;;;;;;;;;;;;;;;;;;;

Label_3:
if My_variable_to_exit_the_loop
  {
    SetTimer, Label_3, Off ; I want to exit before any visible action taken
    return
  }

Send, {F9 Down}
Sleep, 10 ; pause 10ms to allow application to recognize the pressed state
Send, {F9 Up}

return

;;;;;;;;;;;;;;;;;;;;;;;;;

Label_4:
if My_variable_to_exit_the_loop
  {
    SetTimer, Label_4, Off ; I want to exit before any visible action taken
    return
  }

Send, {F10 Down}
Sleep, 10 ; pause 10ms to allow application to recognize the pressed state
Send, {F10 Up}

return
Code:
; OBS Studio non-existing keys test, advanced scripting with timer loops (Studio v0.15.4, ahk v1.0.47.3)

; Start loop as auto-execute, loop until ScrollLock is pressed!!!
; Infinite loop!!! Simulates any statement check each 10ms

SetTimer, Label_1, 10 ; execute subrutine at label_1 each 10ms

; No more auto-executed strings (after first "return" word).

return

;;;;;;;;;;;;;;;;;;;;;;;;;

; my subroutine, checks the state of the F3 key and returns to the loop (timer at 10ms where it called from)
Label_1:
if GetKeyState("F2") ; or any 'your' event is true then go to Label_2
  Gosub, Label_2
return

;;;;;;;;;;;;;;;;;;;;;;;;;

; my subroutine, trigger non-existing f14 key and returns to the loop (where it called from by F2 key press)
Label_2:
Sleep, 30 ; wait for 30ms before trigger next key

Send, {F14 Down}
Sleep, 10 ; pause 10ms to allow application to recognize the pressed state
Send, {F14 Up}
return

;;;;;;;;;;;;;;;;;;;;;;;;;

; Let's program the script suspend by ScrollLock press,
; (for easy script termination when important keys in use).
; Pause timers and loops too.
ScrollLock::
{
Suspend
Pause
}
return

;;;;;;;;;;;;;;;;;;;;;;;;;

; turn f7 to non-existing on my keyboard f17 key (f7 excluded, remap)
F5::F17

; trigger non-existing on my keyboard f19 key each time I press Right Mouse Button, while keep Right Mouse Button func.
~RButton::F19

; turn f8 into NumPad 1 (f8 excluded, remap)
F8::Numpad1

;;;;;;;;;;;;;;;;;;;;;;;;;

; we will loop until f4 is pressed,
F4::My_variable_to_exit_the_loop:=true

; Start loop by f1 key, triggers non existing f13, f16 keys in ~3 sec intervals
F1::
{
My_variable_to_exit_the_loop:=fasle ; we wait for F4
SetTimer, Label_3, 6000
; it is almost impossible to press key f1 and f4 so fast to rise cancel but for other logic it's normal, so you can insert "if->return" there too

Send, {F13 Down} ; execute at least once
Sleep, 10 ; pause 10ms to allow application to recognize the pressed state
Send {F13 Up}

Sleep 3000 ; pause
SetTimer, Label_4, 6000
if My_variable_to_exit_the_loop
  return ; there was delay after key f1 press, so f4 could cancel all the actions

Send, {F16 Down} ; execute at least once
Sleep, 10 ; pause 10ms to allow application to recognize the pressed state
Send, {F16 Up}

}
return

;;;;;;;;;;;;;;;;;;;;;;;;;

Label_3:
if My_variable_to_exit_the_loop
  {
    SetTimer, Label_3, Off ; I want to exit before any visible action taken
    return
  }

Send, {F13 Down}
Sleep, 10 ; pause 10ms to allow application to recognize the pressed state
Send, {F13 Up}

return

;;;;;;;;;;;;;;;;;;;;;;;;;

Label_4:
if My_variable_to_exit_the_loop
  {
    SetTimer, Label_4, Off ; I want to exit before any visible action taken
    return
  }

Send, {F16 Down}
Sleep, 10 ; pause 10ms to allow application to recognize the pressed state
Send, {F16 Up}

return

To setup non-existing keys in OBS Studio use this script:
Code:
; OBS Studio non-existing keys test assignment (Studio v0.15.4, ahk v1.0.47.3)

; assign f1-f12 to non-existing on my keyboard f13-f24

F1::F13
F2::F14
F3::F15
F4::F16
F5::F17
F6::F18
F7::F19
F8::F20
F9::F21
F10::F22
F11::F23
F12::F24

;;;;;;;;;;;;;;;;;;;;;;;;;

; Let's program the script suspend by ScrollLock press,
; (for easy script termination when important keys in use).
ScrollLock::
{
Suspend
}

Please, replace all "ScrollLock" strings from the scripts with key that exist on your keyboard (by pressing it you pause or suspend script from execution).
Simple scripts simulates f3, f6 keypress at ~3 sec intervals (or F13, F16)
"Advanced" scripts has 2 loops: one loop triggered by F1 key and stopped by F4 key, another loop running infinite (test F2 key press or any other statement) from the beginning.

Useful info: https://autohotkey.com/boards/viewtopic.php?t=17281

P.S. About auto-scene switcher plugin it was added: https://github.com/jp9000/obs-studio/commit/39592ff5ebb9aa641ae460b7c044e3fc1cc0196f , wait for new release.
 
Last edited:

Naweo

New Member
Actually I fixed this by executing a controlsend command instead of a send command, although it is a bandaid!

Thanks anyway! :)
 
Top