Hotkey

MarkOBS

Member
I am trying to program a hotkey to launch/minimize/maximize OBS using AHK.

Right now I am getting the following errors from OBS:
Error:
Failed to load locale
Failed to find locale/en-US.ini

Does anyone know how to prevent these errors from occurring?
 

Suslik V

Active Member
When OBS called from batch file or command line - the first thing you need to do is to change current directory:
CD path_to_the_folder_where_obs_exe_lies
 

MarkOBS

Member
When OBS called from batch file or command line - the first thing you need to do is to change current directory:
CD path_to_the_folder_where_obs_exe_lies
Thanks for helping out Suslik.
I use AHK to program many of my keys to do the same as what I am trying to do with OBS.
This is my current code:
Code:
Launch_App1::   ;show/minimize OBS64
IfWinNotExist, OBS64.exe
{
Run, C:\Program Files\obs-studio\bin\64bit\obs64.exe
Sleep, 200
return
}
else
{
WinGet,CurrentState,MinMax, OBS64.exe
if (CurrentState = -1) ; The window is minimized
   WinRestore, OBS64.exe
else
   WinMinimize, OBS64.exe
}
return

The path that I have above C:\Program Files\obs-studio\bin\64bit\obs64.exe
is correct.
 

AaronD

Active Member
The "current directory" - also called the "working directory", which might be less confusing - is part of the environmental context that you're running in. Nothing to do with the path of the executable. If you can't start OBS with only obs64.exe, then your working directory is somewhere else. *That's* what you need to fix.
 

MarkOBS

Member
Thanks folks for helping out!
This is my current code:
Code:
Launch_App1::   ;show/minimize OBS64

If Not WinExist (“OBS 30.0.2 - Profile”)
{
Run, c:\ProgramData\Microsoft\Windows\Start Menu\Programs\OBS Studio\OBS Studio (64bit).lnk
return
}
else
{
WinGet,CurrentState,MinMax, OBS 30.0.2 - Profile
if (CurrentState = -1) ; The window is minimized
   WinRestore, OBS 30.0.2 - Profile: Fresh - Scenes: Test

else
   WinMinimize, OBS 30.0.2 - Profile: Fresh - Scenes: Test
}
Return

It does load OBS64 but instead of minimizing/restoring the app when I press the OBS hotkey again,
it tries to load a second version of the app and asks me if that is what I want to do.
 

MarkOBS

Member
Well I finally have success with the hotkey code!
This is what worked:
Code:
Launch_App1::   ;show/minimize OBS64


IfWinNotExist, OBS 30.0.2 - Profile
{
Run, c:\ProgramData\Microsoft\Windows\Start Menu\Programs\OBS Studio\OBS Studio (64bit).lnk
return
}
else
{
WinGet,CurrentState,MinMax, OBS 30.0.2 - Profile
if (CurrentState = -1) ; The window is minimized
   WinRestore, OBS 30.0.2 - Profile: Fresh - Scenes: Test

else
   WinMinimize, OBS 30.0.2 - Profile: Fresh - Scenes: Test
}
Return

But I have one new problem I'm hoping you folks can help me out with.
I have two camera sources showing on screen.
One camera source has been popping up either as totally white, totally black and now totally dots (purple, white etc.)
One time the totally white resolved by itself into showing the image.
Is there an easy way to fix this and what would be causing the problem?
 
Top