TRsSim(Ai-7280)设备自动导入脚本

from pywinauto.application import Application

import time

i=0

def operator_TRsSim():

    global i

    app=Application().start("C:\Program Files\Advent\TRsSim\TRsSim.exe")

    time.sleep(5)

    #app.top_window()

    #app['TRsSim'].maximize()

    #app.Maximize()

    app.TRsSim.menu_select("Scripting->Open Project...")

    app.window(title_re="Open Script Project File").Edit.type_keys('E:\\007.spj')

    #time.sleep(5)

    app['Open Script Prosject File']['打开(&O)'].click()

    time.sleep(2)

    app.TRsSim.menu_select("Run->Start")

    time.sleep(2)

    app['Script Message']['No'].click()

    app['Script Message']['Auto STEP'].click()

    while (i<=2):

        time.sleep(10)

        app['Script Message']['Pass'].click()

        i=i+1


try:

    app=Application().connect(path="C:\Program Files\Advent\TRsSim\TRsSim.exe")

    try:

        app.TRsSim.close()

    except:

        app['Exit Program']['是(&Y)'].click()

        time.sleep(5)

        operator_TRsSim()

except:

    operator_TRsSim()


按关闭会出现下面对话框

你可能感兴趣的:(TRsSim(Ai-7280)设备自动导入脚本)