-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopen2.py
More file actions
31 lines (27 loc) · 1.09 KB
/
Copy pathopen2.py
File metadata and controls
31 lines (27 loc) · 1.09 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
# vecnode 18-12-2025
import os
import subprocess
def get_app_name_from_operator(_operator):
app_name = str(_operator.par.Value0)
if app_name:
return find_and_open_application(app_name)
else:
print("No application name provided in the operator parameter.")
return False
def find_and_open_application(app_name):
app_name = app_name if app_name.lower().endswith(".exe") else f"{app_name}.exe"
executables = op('search_app_paths').fetch('executables', {})
for full_path, folder in executables.items():
file_name = os.path.basename(full_path)
if file_name.lower() == app_name.lower():
try:
subprocess.Popen([full_path], close_fds=True)
print(f"Successfully launched {app_name} from {folder}")
return True
except Exception as e:
print(f"Failed to launch {app_name} from {folder}: {str(e)}")
return False
print(f"{app_name} not found.")
return False
app_name_str = get_app_name_from_operator(op('app_name'))
print("return: ", app_name_str)