如何使用VB脚本通过QTP启动Swf应用程序



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

试试这个例子:

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
'*********************************************************************************

最新更新