Files
Crypto_Scam/web_sim_autostart.vbs
2026-10-22 20:19:52 +03:00

27 lines
1.3 KiB
Plaintext

' Starts the web simulator without windows (Windows autostart: shortcut in the Startup folder).
' page - pythonw.exe web_proxy.py (0.0.0.0:8765, public; pythonw.exe excluded from the VPN)
' engine - python.exe web_sim.py --backend via web_sim_service.bat (127.0.0.1:8766, restarted if it stops)
' A part that is already running is not started twice.
Set sh = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
dir = fso.GetParentFolderName(WScript.ScriptFullName)
sh.CurrentDirectory = dir
Function Running(pattern)
Running = False
Set procs = GetObject("winmgmts:").ExecQuery("SELECT CommandLine FROM Win32_Process")
For Each p In procs
If Not IsNull(p.CommandLine) Then
If InStr(1, p.CommandLine, pattern, vbTextCompare) > 0 Then Running = True
End If
Next
End Function
' the program's own environment (.venv, made by УСТАНОВИТЬ_И_ЗАПУСТИТЬ.bat) when there is one
pyw = "pyw -3"
If fso.FileExists(dir & "\.venv\Scripts\pythonw.exe") Then pyw = """" & dir & "\.venv\Scripts\pythonw.exe"""
If Not Running("web_proxy.py") Then sh.Run pyw & " """ & dir & "\web_proxy.py""", 0, False
If Not Running("web_sim_service.bat") And Not Running("web_sim.py") Then
sh.Run "cmd /c """ & dir & "\web_sim_service.bat""", 0, False
End If