WScript 不适用于 HPALM 工作流程。但是在命令行中执行时工作正常

WScript doesn't work with HPALM workflow. But works fine when executed in command Line

我正在设置一个新的 HP ALM 工作流脚本来调用 firefox 并在其中打开两个选项卡。

给定的脚本在命令行中非常有用。但是,相同的脚本在 HP-ALM Workflow 中运行不佳。我确定脚本正在被调用,但 firefox 浏览器没有打开。放置警报以调试脚本并显示来自脚本的警报。


Dim wshshell
Set wshshell = WScript.CreateObject("Wscript.Shell")

wshshell.run """firefox.exe"" www.google.com",1,False
wshshell.run """firefox.exe"" www.yahoo.com",2,False

Set wshshell = Nothing
wscript.quit

在 HP ALM 客户端中单击按钮时,应该会打开带有两个选项卡的 firefox。一个带有 google,另一个带有雅虎主页。但是,没有打开任何页面。

最后,以下解决方案有所帮助;

ActionCanExecute()

Function ActionCanExecute()

    On Error Resume Next
    ActionCanExecute = DefaultRes
    browserName = "Mozilla Firefox"
    browserExeName = "Firefox.EXE"
    cmdLineArgPlatform = " -new-window "
    cmdLineArgIdc = " -new-tab "
    sURLPlatform = "www.google.com"
    sURLIdc = "www.yahoo.com"

    Set WSHShell = CreateObject("WScript.Shell")
    exePath = WSHShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\" & _
                     "CurrentVersion\App Paths\" & browserExeName & "\")

    'Open the URL
    sShellCmdPlatform = """" & exePath & """" & "" & cmdLineArgIdc & """" & sURLPlatform & """"
    MsgBox sShellCmdPlatform

    sShellCmdIdc = """" & exePath & """" & "" & cmdLineArgIdc & """" & sURLIdc & """"
    MsgBox sShellCmdIdc

    'MsgBox sFFExe      

    WSHShell.Run sShellCmdPlatform, vbHide
    WSHShell.Run sShellCmdIdc
    On Error Resume Next

    Set WSHShell = Nothing

    ActionCanExecute = DefaultRes

    On Error GoTo 0
End Function