0

我从事 HPQC 的工作流脚本,并希望将示例中给出的一些 VB 代码移植到 VB 脚本中。我无法让接口在 VB 脚本中工作。

VB代码:

 Dim iscp           As ISupportCopyPaste 
 Dim clipboard      As String

 clipboard = iscp.CopyToClipBoard(sourceFolder.NodeID, 0, sourceFolderPath)

我无法在 VB 脚本中将 iscp 声明为 ISupportCopyPaste。

我尝试了一些网络参考,但无法了解它在 VB 脚本中的工作原理。

请分享你的想法..可能会指出我正确的方向..

4

2 回答 2

0

我在http://go-gaga-over-testing.blogspot.com/2011/04/code-to-copy-test-set-from-one-folder.html找到了下面的代码示例它演示了 iSupportCopyPaste 的使用所以也许你可以适应它。

  1. 在 excel vba 编辑器中添加以下代码。
  2. 将“OTA COM 类型库”添加为工具 -> 来自 excel 的引用下的引用。
  3. 奔跑并享受魔法:-) 3。

解决方案:

Public Function CopyPasteTestSetFolder(sourceFolderPath, destFolderPath)

    strServer = "http://xyz/qcbin"
    strDomain = ""
    strProject = ""
    strUser = ""
    strPassword = ""

    Set objTDConnection = CreateObject("tdapiole80.TDCONNECTION")
    objTDConnection.InitConnection strServer, strDomain
    objTDConnection.ConnectProject strProject, strUser, strPassword

    Set objTreeManager = objTDConnection.TestSetTreeManager
    Set sourceFolder = objTreeManager.NodeByPath(sourceFolderPath)
    Set destFolder = objTreeManager.NodeByPath(destFolderPath)

    Dim iscp As ISupportCopyPaste

    Set iscp = sourceFolder

    clipboard = iscp.CopyToClipBoard(sourceFolder.NodeID, 0, sourceFolderPath)

    Set iscp = destFolder
    iscp.PasteFromClipBoard clipboard, destFolder.NodeID, 0, -1

    Set treeMng = Nothing
    Set sourceFolder = Nothing
    Set destFolder = Nothing
    Set iscp = Nothing

End Function
于 2013-02-14T16:14:49.663 回答
-1

enterSearchContent = Inputbox("输入搜索内容") entersearchterm = Inputbox("输入搜索词")

调用 funcSearchContentMatchCount(enterSearchContent,entersearchterm)

函数 funcSearchContentMatchCount(strsearchcontent,strsearchterm)

If Typename(enterSearchContent) = "String"  Then
    If len(enterSearchContent) >0 Then
        strsearchcontent = Lcase(cstr(enterSearchContent))
    else
        msgbox "Content is blank"
    End If
Else
    msgbox "Not a valid string"
End If

If Typename(entersearchterm) = "String"  Then
    If len(entersearchterm) >0  and len(enterSearchContent)>len(entersearchterm) Then
        strsearchterm = Lcase(cstr(entersearchterm))
    else
        msgbox "Search Term is blank or Search Term Length is greater than Search Content"
    End If
Else
    msgbox "Not a valid string"
End If


arrstrsearchcontent = split(strsearchcontent," ")
intsearchterm = 0
intsearchtermExactMatch = 0
For i = 0 To Ubound(arrstrsearchcontent) Step 1
    If instr(arrstrsearchcontent(i),strsearchterm)<>0 Then
        intsearchterm = intsearchterm+1
        If strcomp(arrstrsearchcontent(i),strsearchterm,0) = 0 Then
            intsearchtermExactMatch = intsearchtermExactMatch+1
        End If
    End If
Next
TotalMatchCount = intsearchterm
TotalExactMatchCount = intsearchtermExactMatch
Msgbox "Total Number of occurences of Search Term is "&TotalMatchCount
Msgbox "Total Number of Exact occurences of Search Term is "&TotalExactMatchCount

结束功能

于 2018-02-01T18:01:27.877 回答