【问题标题】:Run VBScript macro on Exiting Catia Automatically在自动退出 Catia 时运行 VBScript 宏
【发布时间】:2015-10-16 09:14:56
【问题描述】:

我希望在退出 Catia 时能够自动运行批处理文件。因此,当我选择文件退出菜单选项时,批处理文件将运行。同样,当我单击右上角的 Catia 关闭 X 按钮时。批处理文件也将运行。退出 Catia 时是否有特定的子函数执行?

下面的 vbscript 启动批处理文件。

Sub CATmain()
Dim shell
Set shell = CreateObject("wscript.shell")
shell.Run "c:\windows\temp\test.bat"
End Sub

非常感谢任何帮助。

【问题讨论】:

    标签: shell batch-file vbscript catia


    【解决方案1】:

    配置 Catia 以在它退出时运行批处理脚本取决于 Catia。一种解决方法可能是从批处理脚本启动 Catia,该脚本在返回时会运行 test.bat

    === runcatia.bat

    SETLOCAL
    SET EXITCODE=0
    
    catia.exe
    SET EXITCODE=%ERRORLEVEL%
    "c:\windows\temp\test.bat"
    EXIT /B %EXITCODE%
    

    【讨论】:

      猜你喜欢
      • 2017-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多