run on startup silently
This commit is contained in:
4
run_silent.bat
Normal file
4
run_silent.bat
Normal file
@@ -0,0 +1,4 @@
|
||||
@echo off
|
||||
cd /d "%~dp0"
|
||||
call venv\Scripts\activate.bat
|
||||
start "" pythonw src\main.pyw
|
||||
4
run_silent.vbs
Normal file
4
run_silent.vbs
Normal file
@@ -0,0 +1,4 @@
|
||||
Set WshShell = CreateObject("WScript.Shell")
|
||||
strPath = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName)
|
||||
WshShell.Run chr(34) & strPath & "\run_silent.bat" & Chr(34), 0
|
||||
Set WshShell = Nothing
|
||||
Binary file not shown.
@@ -232,7 +232,12 @@ def main():
|
||||
ensure_single_instance()
|
||||
config = load_config()
|
||||
# Sync startup state just in case it was changed externally
|
||||
config["run_on_startup"] = is_in_startup()
|
||||
if is_in_startup():
|
||||
config["run_on_startup"] = True
|
||||
# Update the registry key to point to the current location (in case the app was moved)
|
||||
add_to_startup()
|
||||
else:
|
||||
config["run_on_startup"] = False
|
||||
save_config(config)
|
||||
|
||||
# Start the tray icon in a separate thread
|
||||
|
||||
@@ -2,7 +2,11 @@ import os
|
||||
import winreg
|
||||
|
||||
APP_NAME = "OopsWrongLang"
|
||||
RUN_BAT_PATH = os.path.abspath("run.bat")
|
||||
# Get the directory of the current script (src)
|
||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
# The project root is one level up
|
||||
project_root = os.path.dirname(current_dir)
|
||||
RUN_BAT_PATH = os.path.join(project_root, "run_silent.vbs")
|
||||
|
||||
def add_to_startup():
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user