如何使用VB Scripting通过QTP启动Swf应用程序?

时间:2015-10-20 06:11:51

标签: vbscript qtp hp-uft

我想通过vb脚本代码启动swf应用程序,在qtp中创建函数库。

1 个答案:

答案 0 :(得分:1)

试试这个样本:

Option Explicit
Dim Application
Application = "D:\Offroad Madness.swf" 'Path to your swf file.Just change this line
Call RunThis(Application)
'*********************************************************************************
Sub RunThis(Application)
    Dim Title,Ws,Question,Result
    Title = "Open SWF Files by Hackoo 2015"
    Set Ws = CreateObject("WScript.Shell")
    Question = MsgBox("Did you want to open this file "& DblQuote(Application) &" with iexplore ?" & Vbcr &_
    "Yes ==> To open the swf file with iexplore" & Vbcr &_
    "No  ==> To open the swf file with default program" & Vbcr &_
    "Cancel ==> To quit this script",vbQuestion+vbYesNoCancel,Title)
    If Question = vbYes Then
        Result = Ws.Run("iexplore.exe "& DblQuote(Application),1,False)
    End If
    If Question = vbNo Then
        Result = Ws.Run(DblQuote(Application),1,False)
    End If
    If Question = vbCancel Then
        Wscript.Quit()
    End If
End Sub
'*********************************************************************************
Function DblQuote(Str)
    DblQuote = Chr(34) & Str & Chr(34)
End Function
'*********************************************************************************