【问题标题】:WScript doesn't work with HPALM workflow. But works fine when executed in command LineWScript 不适用于 HPALM 工作流程。但是在命令行中执行时工作正常
【发布时间】:2019-06-21 15:27:09
【问题描述】:

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

给定的脚本就像命令行中的魅力一样。但是,相同的脚本不能很好地工作流 HP-ALM 工作流。我确定脚本正在被调用,但火狐浏览器没有打开。放置警报以调试脚本并显示来自脚本的警报。


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。一个与谷歌和其他与雅虎主页。但是,没有打开任何页面。

【问题讨论】:

  • 为什么在后者run中使用…,2,False?第二个参数是窗口样式2 表示激活窗口并将其显示为最小化窗口。我会尝试将第二个和第三个参数都省略为wshshell.run """firefox.exe"" www.yahoo.com"
  • 如果您发现有帮助的答案,您应该考虑accept the answer 和/或vote up

标签: vbscript hp-alm


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-29
    • 1970-01-01
    • 1970-01-01
    • 2017-05-07
    • 2011-10-24
    相关资源
    最近更新 更多