import os
import sys
import subprocess
import tkinter as tk
def list_files_with_suffix(suffix):
# Get the current working directory
current_directory = os.getcwd()
# List all files in the directory
files_with_suffix = [
file for file in sorted(os.listdir(current_directory))
if os.path.isfile(file) and file.endswith(suffix)
]
return files_with_suffix
suffix = '.res'
files = list_files_with_suffix(suffix)
f = open("result.html", "w") # 'r' for reading and 'w' for writing
f.write("
\n") # Write inside file
processes = []
for file in files:
fileNameBase = file.rsplit('.', 1)[0]
try:
f.write("| "+file+" |  |  |  |
\n")
process = subprocess.Popen([sys.executable, "arbinDataImport4.py", "file="+file, "diameter=9", "noShow", "savePlot", "auxV"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
processes.append(process)
except FileNotFoundError:
print(f"Script {script_path} not found.")
f.write("
\n")
f.close()
while True:
running_count = 0
for process in processes:
if process.poll() is None:
running_count += 1
print(f"Number of running processes: {running_count}")
if running_count == 0:
break
time.sleep(3)
done = tk.Tk()
label = tk.Label(done, text="done")
label.grid(row='0',column='0')
done.mainloop()