#! python3 import mhrc.automation, os from win32com.shell import shell, shellcon # Find "Public Documents" folder # Probably "C:\Users\Public\Documents" public_dir = shell.SHGetFolderPath(0, shellcon.CSIDL_COMMON_DOCUMENTS, None, 0) # Find the "Tutorial" workspace # Probably "\PSCAD\4.6.3\Examples\tutorial\Tutorial.pswx" tutorial_dir = next(root for root, _, files in os.walk( os.path.join(public_dir, "PSCAD") ) if "Tutorial.pswx" in files) # Launch PSCAD pscad = mhrc.automation.launch_pscad() # Load the tutorial workspace pscad.load(os.path.join(tutorial_dir, "Tutorial.pswx")) # Run all the simulation sets in the workspace pscad.run_all_simulation_sets() # Exit PSCAD pscad.quit()