From db2adcb15e5487f0250c725a03cb4c0e1ed561fa Mon Sep 17 00:00:00 2001 From: Peter Date: Thu, 9 Nov 2023 15:24:22 +0800 Subject: [PATCH] Instal and run scripts, recognize maximized views --- README.md | 21 +++++++++++++++------ icons/graph.png | Bin 13783 -> 9210 bytes icons/schematic.png | Bin 16788 -> 16788 bytes install.ps1 | 4 ++++ ltspice-discord.py | 27 +++++++++++++++++++-------- run.ps1 | 3 +++ 6 files changed, 41 insertions(+), 14 deletions(-) create mode 100644 install.ps1 create mode 100644 run.ps1 diff --git a/README.md b/README.md index 4dfb34a..268e02b 100644 --- a/README.md +++ b/README.md @@ -6,18 +6,27 @@ Install dependencies: -```bash -python -m venv .venv -source .venv/bin/activate -python -m pip install -r requirements.txt +```powershell +.\install.ps1 ``` Run with: -```bash -python .\ltspice-discord.py +```powershell +.\run.ps1 ``` +Create a shortcut in `shell:startup` to start listening on startup: + +Target: `C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command [PATH]\ltspice-discord\run.ps1`\ +Start in: `[PATH]\ltspice-discord\` + +## How does it work + +This script extracts file type from the title of any LTspice application then uses it to update the status on Discord. + +The code should be short enough to audit if you are worried about data exfiltration, etc. + ## Icons Icons adapted from: diff --git a/icons/graph.png b/icons/graph.png index 513360c2ade0f7d22e343d1f4461e17cad82f4e2..b438ee9304235e079822d5c6bd4086e2aaf09dd9 100644 GIT binary patch literal 9210 zcmds7d0fo-|Nnd@9~~2!(iFPOwzi>Y*Cwi=V`?|Ch+=7q#1SL# zX1WZ9VUujEEmmNd1T-ZuDfE-<)Sd%BxYr8S5-j7PN)vP@xGi3~7{jt+sRPag^ktXZ zuClz03CTau$6`7UR-kdaSJ8cfA}q7xI%~L(R5Bkwfo-BZsoX5}!m6 zk1jZ3>yMK^KPT6|bb7@ITuQ~Lj}8(SFJr$uaK8Cc6Pr~?X)I@O<~$Jl!RC~=eaPJT zYi$7&YpHaPB~4E%JDRT4~w$K_@C*-p~Q4< zLTlO6&nONrE7lb4u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k@>gz@tmDaY(H+L9Q*Jci3iqv2RdTKKojU{KCw-r zlls!b$>yVsF;t;z*}AZ%m}1=*Dv=LtT%7+*tm{h*1oJJ#5lnFu5QbetY1w3h`qZJJfv_#%}q$ zg=?q`_Oup?Xdy)OFo%ggVCt8K5`!Ri zEZFx&-?G~ql3$vB+A*oo_|uM*g!?!v{j=1%?z@9J7k!7NY<;QmjoB^@{sXJlDHdck zpGtI0O#OY@*oMc~XU?a6c9x}zX3xz?<$k>q+i%_NU+ti|uIfGX6OVJxyh>KGHhF?W z{)D+HHfk#LeTVqyCxpyfohy$TyHrs(1qOsj_sqeyXjgP!^`SGddAFi%e113+=XK2R zUQ~!zj{VKBk+xC&j^tcs|5W&_HUxg@+&-@B<&JT7YdUhD^j-M3XZ-BTZ&+OY|EHL& hgpxR^t1dKHUD!D2S80H=GyVAL!;#}h9Pw4g{SRH;IgtPW diff --git a/icons/schematic.png b/icons/schematic.png index cbfaf883681d6a4796ec8647f503823c9e9e8aa3..a616d123db59fdd8c5895fae770da2e63520ce70 100644 GIT binary patch delta 23 ecmbQz%s8c)ae^n;AqED%LyV#tUJV None: global last_state filename = title.replace("LTspice XVII - ", "") file, ext = os.path.splitext(filename) + + # The window title is of the format "LTspice XVII - [filename.extension]" + # if the view is maximized + if ext and ext[-1] == "]": + ext = ext[:-1] + file = file[1:] + # filename = filename[1:-1] + state = {} if ext in (".asc",): # SCHEMATICS state = { @@ -116,14 +124,17 @@ def main() -> None: foreground_hwnd = win32gui.GetForegroundWindow() pid = win32process.GetWindowThreadProcessId(foreground_hwnd) if pid[-1] >= 0: - active_process = psutil.Process(pid[-1]) - if active_process.name() in WINDOW_HANDLERS.keys(): - handler = WINDOW_HANDLERS[active_process.name()] - if handler(win32gui.GetWindowText(foreground_hwnd)): - last_program = { - "pid": active_process.pid, - "path": active_process.name(), - } + try: + active_process = psutil.Process(pid[-1]) + if active_process.name() in WINDOW_HANDLERS.keys(): + handler = WINDOW_HANDLERS[active_process.name()] + if handler(win32gui.GetWindowText(foreground_hwnd)): + last_program = { + "pid": active_process.pid, + "path": active_process.name(), + } + except psutil.NoSuchProcess: + pass if last_program["pid"] is not None and last_program[ "pid" ] not in find_active_processes(last_program["path"]): diff --git a/run.ps1 b/run.ps1 new file mode 100644 index 0000000..b99494a --- /dev/null +++ b/run.ps1 @@ -0,0 +1,3 @@ +cd $(Split-Path $MyInvocation.MyCommand.Path) +.\.venv\Scripts\Activate.ps1 +Start-Process "python" -ArgumentList "ltspice-discord.py" -WindowStyle Hidden