I have below code which opens the txt file and do maximized window but am unable to bring opened txt file at front also it is able to take screenshot but again not able to close the opened text file...
import os
from tkinter import *
import subprocess
import pyscreenshot as ImageGrab
aaa = "path\file.txt"
a = subprocess.Popen(["cmd","/C","start","/max",aaa])
#need to add code to bring opened window in front
aaa1 = ImageGrab.grab(bbox=(0,0,1000,1000))
aaa1.save(path/aaa.jpg)
a.terminate() #this line also does not work