0

I work on workflow scripts of HPQC, and wanted to port some VB code given in the examples to VB script. I am not able to get the interfaces working in VB script.

VB Code:

 Dim iscp           As ISupportCopyPaste 
 Dim clipboard      As String

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

I am not able to declare iscp as ISupportCopyPaste in VB script.

I tried some webreferences but not able get the idea about how this works in VB script.

Please share ur thoughts.. may be point me in correct direction..

aksarc
  • 13
  • 8
  • I didn't think VBScript was typed. Does just defining it as `Object` have the desired result? – Deanna Feb 14 '13 at 10:41
  • 2
    VbScript isn't typed, but that means everything is Variant, not Object. VbScript syntax doesn't support the As keyword, so just Dim iscp should be what the OP is looking for. – BobRodes Feb 14 '13 at 16:44
  • Something bizarre there anyway. It looks like a class and not an interface. Probably just named incorrectly. No idea where this class comes from, it isn't anything standard and a VB6 program already has a ClipBoard object anyway. Must be some 3rd party specialized clipboard class. – Bob77 Feb 15 '13 at 02:24
  • @Deanna Tried that too.. – aksarc Feb 15 '13 at 06:58
  • @BobRodes `Dim iscp` passes compilation but did not give any output, in teh sense the copy function did not get executed. – aksarc Feb 15 '13 at 06:58
  • @Bob77 You are correct this is part of HPQC work flow scripting. There are predefined VB code (object, interface, methods, properties etc..) we need to fit that in the VB script code that is actually in the HPQC workflow. – aksarc Feb 15 '13 at 06:59

2 Answers2

0

I found the code sample below at http://go-gaga-over-testing.blogspot.com/2011/04/code-to-copy-test-set-from-one-folder.html It demonstrates the use of iSupportCopyPaste so maybe you'll be able to adapt it.

  1. Add the following code in excel vba editor.
  2. Add the "OTA COM Type Library" as a reference under tools -> references from excel.
  3. Run and enjoy the magic :-) 3.

Solution:

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
jac
  • 9,666
  • 2
  • 34
  • 63
  • Thank you.. I too checked this earlier.. but here also the `Dim iscp As ISupp... ` is given with `As ` keyword. Hence the issue.. – aksarc Feb 15 '13 at 07:00
-1

enterSearchContent = Inputbox("Enter Search Content") entersearchterm = Inputbox("Enter Search Term")

Call funcSearchContentMatchCount(enterSearchContent,entersearchterm)

Function 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

End Function

Ram
  • 1