-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFLOWORK.vbs
More file actions
60 lines (44 loc) · 2.05 KB
/
FLOWORK.vbs
File metadata and controls
60 lines (44 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
' Auto-generated by Flowork Installer
' MODIFIED: To add a first-run check for a lock file (teetah.art).
Set WshShell = CreateObject("WScript.Shell")
scriptPath = WScript.ScriptFullName
Set fso = CreateObject("Scripting.FileSystemObject")
scriptDir = fso.GetParentFolderName(scriptPath)
' --- Define key file names ---
' NOTE: These are the files checked/run by this launcher.
Dim lockFileName, debugScriptName
lockFileName = "teetah.art"
debugScriptName = "DEBUG.bat"
' --- Build full paths ---
' NOTE: Constructing full paths to avoid ambiguity.
Dim lockFilePath, debugScriptPath
lockFilePath = fso.BuildPath(scriptDir, lockFileName)
debugScriptPath = fso.BuildPath(scriptDir, debugScriptName)
' --- Smart Launch Logic ---
' NOTE: Check if the lock file exists to determine if this is the first run.
If fso.FileExists(lockFilePath) Then
' --- NORMAL EXECUTION PATH ---
' NOTE: The AO.LA file exists, so we proceed with the standard silent launch.
' We use 'poetry run' to execute the script within its virtual environment.
Dim command_normal
command_normal = "cmd.exe /c ""cd /d " & chr(34) & scriptDir & chr(34) & " && poetry run pythonw pre_launcher.py"""
' NOTE: The '0' hides the window, 'False' to ensure it runs in the background.
WshShell.Run command_normal, 0, False
Else
' --- FIRST RUN / DEBUG PATH ---
' NOTE: The teetah.art file does not exist. We will run the debug/setup script first.
Dim command_debug
command_debug = chr(34) & debugScriptPath & chr(34)
' NOTE: We run the debug script visibly and wait for it to complete.
' The '1' shows the window, 'True' forces the script to wait for it to finish.
WshShell.Run command_debug, 1, True
' NOTE: After the debug script is done, create the empty lock file
' to ensure normal execution on the next run.
Dim lockFile
Set lockFile = fso.CreateTextFile(lockFilePath, True)
lockFile.Close
Set lockFile = Nothing
End If
' Clean up objects
Set fso = Nothing
Set WshShell = Nothing