Question / Help OBS and AHK Script for Hotkeys

Status
Not open for further replies.

RyzaJr

New Member
Hey all,

So I'm trying to create an AutoHotKey script for OBS1 that automatically hits the game capture hotkey when I hit the record/stream hotkey. I got most of this code from a web search of AHK scripts that detect fullscreen apps or games.

The following code seems to send Scroll Lock and F12 to the game, but not OBS? If anyone knows what I am doing wrong, please help. Thanks.

Code:
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

;#NoTrayIcon
#Persistent

;---Check if Full Screen Active Subroutine
Check_FullScreenActive:
wingetpos,,,w,h,A
wwwh=%w%%h%
swsh=%a_screenwidth%%a_screenheight%
WinGet, Style, Style, A
FullScreenActive := false
if !(Style & 0xC00000) {
  if(wwwh = swsh) {
    FullScreenActive := true
  }
}
return

ScrollLock::
Gosub Check_FullScreenActive
If (FullScreenActive) {
    Send {ScrollLock}
    Send {F12}
}
If !(FullScreenActive) {
    Send {ScrollLock}
}
return
 
Status
Not open for further replies.
Back
Top