Skip to content

Instantly share code, notes, and snippets.

@oO0oO0oO0o0o00
Created September 5, 2020 03:18
Show Gist options
  • Save oO0oO0oO0o0o00/46eb2c134d3d57889ea9d1534a6e434c to your computer and use it in GitHub Desktop.
Save oO0oO0oO0o0o00/46eb2c134d3d57889ea9d1534a6e434c to your computer and use it in GitHub Desktop.
Run 100% Orange Juice on secondary display (incl. virtual display + stream to Steam Link during working time)
@if (@CodeSection == @Batch) @then
@echo off
REM run 100% Orange Juice on secondary screen
REM pay attention to "*** TODO: ***"s in the script
REM Download & install cmdow.exe (https://ritchielawrence.github.io/cmdow) & add to PATH
echo Starting Juice from Sbeam...
echo No mannual operation to avoid undefined consequence!
start steam://rungameid/282800
:loop
REM poll every one second
TIMEOUT /T 1 /NOBREAK >NUL
REM saving command "cmdow 100% Oran* 2>nul" 's output to variable `var`
REM *** TODO: ***
REM change the window title to the actual window title in your language
REM for ascii percentage mark, use two of it
FOR /F "tokens=* USEBACKQ" %%F IN (`cmdow 100%% Oran* 2^>nul`) DO (
SET var=%%F
)
REM not guaranteed on slow computers
if not defined var goto loop
REM wait for Steam's "Waiting for xxx to launch" to disappear
if not "meow%var:team=%" == "meow%var%" goto loop
REM press Enter
REM *** TODO: ***
REM change the window title of Juice's settings window to the actual title of your language
if not "nya%var:Settings=%" == "nya%var%" (
CScript //nologo //E:JScript "%~F0"
TIMEOUT /T 2 /NOBREAK >NUL
goto skip
)
:skip
REM *** TODO: ***
REM set the real position and size of the secondary display below
REM change the window title to the actual window title in your language
cmdow "100%% Oran*" /mov 0 2140 /siz 1920 1080 /ren Mails
goto :EOF
@end
// JavaScript code used to simulate pressing of Enter key
var WshShell = WScript.CreateObject("WScript.Shell");
// switch Juice's settings window back to the front here
// since the running of JavaScript creates a new cmd window on top of it
// *** TODO: ***
// change the window title to the actual window title in your language
// one percentage mark here
WshShell.Run("cmdow 100% Oran* /ACT")
WshShell.SendKeys("{ENTER}");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment