##dm_ver:3.1233## ##Monitor del-map-test.bat is runing or not,by navy,20211222## import win32com.client import os,sys if len(sys.argv) == 1: print('Please input the windows_name you want to monitor!') sys.exit() window_name = str(sys.argv[1]) print('Target window: ' + window_name) try: dm = win32com.client.Dispatch('dm.dmsoft') except Exception as e: print(e) print('dm not installed,stalling...') tmp = os.popen('regsvr32 /s dm.dll').readlines() print(tmp) try: dm = win32com.client.Dispatch('dm.dmsoft') except Exception as e: print(e) print('dm install fail,please check!') sys.exit() hwnd1 = dm.FindWindow("",window_name) print(hwnd1) if 'hwnd1' in dir(): if hwnd1 >0: print('Target window is running.') else: print('Target window is not running.') else: print('hwnd1 not defined,dm is abnormal.')