fixed run.bat and created config&run.bat for easy configuration.

This commit is contained in:
2025-08-10 11:01:34 +03:30
parent 43ac0b1e3b
commit 25ef29be4b
3 changed files with 25 additions and 2 deletions

20
config&run.bat Normal file
View File

@@ -0,0 +1,20 @@
@echo off
REM run.bat
REM Activates the virtual environment and runs your main Python script.
REM Activate the virtual environment
call venv\Scripts\activate.bat
REM run the config script
python src\config.py
REM Check if the activation was successful
if errorlevel 1 (
echo Failed to activate the virtual environment.
pause
exit /b 1
)
REM Run your main Python script (replace main.py with your script name if different)
start "OopsWrongLang" /B pythonw src\main.pyw
echo application is running in the background. you can close this window.
pause

View File

@@ -6,6 +6,6 @@ REM Activate the virtual environment
call venv\Scripts\activate.bat call venv\Scripts\activate.bat
REM Run your main Python script (replace main.py with your script name if different) REM Run your main Python script (replace main.py with your script name if different)
start "OopsWrongLang" /B python src\main.pyw start "OopsWrongLang" /B pythonw src\main.pyw
echo application is running in the background. you can close this window. echo application is running in the background. you can close this window.
pause pause

View File

@@ -1,6 +1,6 @@
import os import os
import keyboard import keyboard
import time
CONFIG_FILE = "shortcut.txt" CONFIG_FILE = "shortcut.txt"
def get_shortcut(): def get_shortcut():
@@ -32,9 +32,11 @@ if __name__ == "__main__":
print('do you want to change the shortcut? (y/n): ', end='') print('do you want to change the shortcut? (y/n): ', end='')
if input().lower() == 'y': if input().lower() == 'y':
while True: while True:
time.sleep(0.2)
print("Please press the key combination you want to use as a shortcut and then press ESC.") print("Please press the key combination you want to use as a shortcut and then press ESC.")
new_shortcut = keyboard.read_hotkey(suppress=False) new_shortcut = keyboard.read_hotkey(suppress=False)
print(f"You pressed: {new_shortcut}") print(f"You pressed: {new_shortcut}")
time.sleep(0.5)
confirm = input("Is this correct? (y/n): ").lower() confirm = input("Is this correct? (y/n): ").lower()
if confirm.lower() == 'y': if confirm.lower() == 'y':
with open(CONFIG_FILE, "w") as f: with open(CONFIG_FILE, "w") as f:
@@ -43,6 +45,7 @@ if __name__ == "__main__":
break break
else: else:
print("Let's try again.") print("Let's try again.")
else: else:
print("No changes made to the shortcut.") print("No changes made to the shortcut.")
print("Exiting without changes.") print("Exiting without changes.")