generated from dopt-python/py311
fix startup script
This commit is contained in:
6
scripts/Launch_App_Fallback.bat
Normal file
6
scripts/Launch_App_Fallback.bat
Normal file
@@ -0,0 +1,6 @@
|
||||
@echo off
|
||||
:: 1. Safely navigate to the exact folder this batch file is sitting in
|
||||
cd /d "%~dp0"
|
||||
|
||||
:: 2. Launch the app in the background and instantly close the command prompt
|
||||
start "" "python\pythonw.exe" -m my_package.gui
|
||||
@@ -19,6 +19,20 @@ if ($? -eq $false){
|
||||
}
|
||||
Write-Output "Deleted outstanding artifacts successfully"
|
||||
|
||||
|
||||
Write-Output "Create data folder..."
|
||||
$pattern = "dopt_nafka_wce-crm_v*"
|
||||
$data_folder = Join-Path -Path $ENV_PATH -ChildPath 'data'
|
||||
|
||||
if (-not (Test-Path -Path $data_folder)){
|
||||
Write-Output "[PWSH] Data path not existing. Create..."
|
||||
New-Item -Path $data_folder -ItemType Directory
|
||||
}
|
||||
else {
|
||||
Write-Output "Data path already exists."
|
||||
}
|
||||
|
||||
|
||||
Write-Output "Building package..."
|
||||
.\scripts\publish.ps1
|
||||
if ($? -eq $false){
|
||||
@@ -56,17 +70,6 @@ if ($? -eq $false){
|
||||
}
|
||||
Write-Output "Successfully installed package"
|
||||
|
||||
# copy CLI file
|
||||
# TODO add startup file
|
||||
# Write-Output "Copying CLI script file..."
|
||||
# $cli_path = Join-Path -Path $SRC_PATH -ChildPath 'cli.py'
|
||||
# Copy-Item -Path $cli_path -Destination $PY_PATH -Force
|
||||
# if ($? -eq $false){
|
||||
# Write-Output "[PWSH] Exiting script because there were errors while copying the CLI script file"
|
||||
# Exit
|
||||
# }
|
||||
# Write-Output "Copied CLI script file successfully"
|
||||
|
||||
# copy database file
|
||||
Write-Output "Copying database files..."
|
||||
$copy_file = Join-Path -Path $SRC_PATH -ChildPath 'data/db/wce_grunderfassung.db'
|
||||
@@ -97,18 +100,12 @@ Write-Output "Copied ENV file successfully"
|
||||
|
||||
# copy startup script files
|
||||
Write-Output "Copying startup scripts..."
|
||||
$copy_file = Join-Path -Path $SRC_PATH -ChildPath 'scripts/start.*'
|
||||
$copy_file = Join-Path -Path $SRC_PATH -ChildPath 'scripts/start.bat'
|
||||
Copy-Item -Path $copy_file -Destination $ENV_PATH -Force
|
||||
if ($? -eq $false){
|
||||
Write-Output "[PWSH] Exiting script because there were errors while copying startup scripts"
|
||||
Exit
|
||||
}
|
||||
# $copy_file = Join-Path -Path $SRC_PATH -ChildPath 'data/db/wce_crm.db'
|
||||
# Copy-Item -Path $copy_file -Destination $dest_file -Force
|
||||
# if ($? -eq $false){
|
||||
# Write-Output "[PWSH] Exiting script because there were errors while copying database 'CRM'"
|
||||
# Exit
|
||||
# }
|
||||
Write-Output "Copied startup scripts successfully"
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
@echo off
|
||||
cd /d "%~dp0"
|
||||
start "" "python\pythonw.exe" -m wce_crm.gui
|
||||
:: 1. Navigate directly into the python environment folder
|
||||
cd /d "%~dp0python"
|
||||
@REM cd /d "python"
|
||||
@REM python.exe -m my_package.gui
|
||||
:: 2. Launch pythonw silently
|
||||
start "" "pythonw.exe" -m wce_crm.gui
|
||||
@@ -1,13 +1,17 @@
|
||||
Set WshShell = CreateObject("WScript.Shell")
|
||||
Set FSO = CreateObject("Scripting.FileSystemObject")
|
||||
|
||||
strScriptDir = FSO.GetParentFolderName(WScript.ScriptFullName)
|
||||
WshShell.CurrentDirectory = strScriptDir
|
||||
' 1. Get the exact path to the python_env folder
|
||||
strEnvDir = FSO.GetParentFolderName(WScript.ScriptFullName) & "\python"
|
||||
|
||||
pythonExe = strScriptDir & "\python\python.exe"
|
||||
' 2. Set the working directory (crucial so pythonw.exe finds its DLLs)
|
||||
WshShell.CurrentDirectory = strEnvDir
|
||||
|
||||
' Use cmd.exe /c (close when done) as a trusted bridge to launch the module
|
||||
runCommand = "cmd.exe /c " & Chr(34) & pythonExe & Chr(34) & " -m wce_crm.gui"
|
||||
' 3. Get the ABSOLUTE path to the executable, not just the file name
|
||||
pythonExe = strEnvDir & "\pythonw.exe"
|
||||
|
||||
' Set back to 0 (Hidden).
|
||||
' 4. Build the command using the absolute path
|
||||
runCommand = Chr(34) & pythonExe & Chr(34) & " -m wce_crm.gui"
|
||||
|
||||
' 5. Run it completely hidden
|
||||
WshShell.Run runCommand, 0, False
|
||||
Reference in New Issue
Block a user