well, I succeeded, so I thought I would share.
Here is a (relatively simple) proof of concept which starts two processes, one which handles main logic and output, and one which handles input.
There are many things which I have plans to improve, but this is the basic idea.
Hope someone likes it!
Note: I would suggest running it in it's own new window, as It doesn't exit gracefully.
Code: Select all
@echo off & setlocal enabledelayedexpansion
cls
if /I {%1}=={input} goto input
if /I {%1}=={output} goto output
title 1234567890987654321
for /f "tokens=1,2 delims=:" %%i in ('tasklist /fi "windowtitle eq 1234567890987654321" /fo list') do (
if "%%i"=="PID" set "my_pid=%%j"
)
set my_pid=%my_pid: =%
start /b "" cmd /c "%0" input > nul
start /b /wait "" cmd /c "%0" output < nul
exit /b
:input
set key=
for /f "delims=" %%i in ('xcopy /w "%~f0" "%~f0" 2^> nul') do (
if not defined key set "key=%%i"
)
set "key=%key:~-1%"
title %key%
goto input
:output
for /f "tokens=1,2 delims=:" %%i in ('tasklist /v /fi "pid eq %my_pid%" /fo list') do (
if "%%i"=="Window Title" set "key=%%j"
)
set key=%key: =%
if defined key (
if "!key:~0,1!"=="!key!" (
echo main: !key!
)
)
goto output