Forum Discussion

carl_nagle's avatar
carl_nagle
New Contributor
11 years ago
Solved

TC/TE VBScript Runtime Version information

Any info on the following scenario would be appreciated.



We need our VBScript libraries to be able to know and route according to the version of TestComplete or TestExecute running.  Are there VBScript APIs that can provide that information?



For example, in certain libraries we will need to branch based on:



Is it TestComplete that is running?  Or is it TestExecute?

Is it version 9.3?  Or is it version 10?



Is it possible to get this information through an existing API or COM interface at runtime?



Any help will be appreciated.



Carl Nagle

SAS Research and Development

Planning, Operations and Strategy

General Applications and Tools

  • Hi Carl,



    What about this code snippet (untested, off top of my head):

    Set p = Sys.WaitProcess("TestComplete", 500)

    If (p.Exists) Then _

      Call Log.Message("TC detected")



    Set p = Sys.WaitProcess("TestExecute", 500)

    If (p.Exists) Then _

      Call Log.Message("TE detected")



    If (Not p.Exists) Then _

      Call Log.Warning("Neither TC nor TE was detected")



    iVerMajor = aqConvert.VarToInt(p.FileVersionInfo.MajorPart)

    Call Log.Message(aqString.Format("Major version # is: %i", iVerMajor))

3 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Carl,



    What about this code snippet (untested, off top of my head):

    Set p = Sys.WaitProcess("TestComplete", 500)

    If (p.Exists) Then _

      Call Log.Message("TC detected")



    Set p = Sys.WaitProcess("TestExecute", 500)

    If (p.Exists) Then _

      Call Log.Message("TE detected")



    If (Not p.Exists) Then _

      Call Log.Warning("Neither TC nor TE was detected")



    iVerMajor = aqConvert.VarToInt(p.FileVersionInfo.MajorPart)

    Call Log.Message(aqString.Format("Major version # is: %i", iVerMajor))

  • carl_nagle's avatar
    carl_nagle
    New Contributor
    With locally necessary changes, your "off the top of my head" code worked for me:



    Dim p, iVerMajor, iVerMinor    

        Set p = Sys.WaitProcess("TestComplete", 500)

        If (p.Exists) Then

            SAFSDEBUG "TCAFS sees TestComplete running!", DEBUG_INFO

        else

            Set p = Sys.WaitProcess("TestExecute", 500)

            If (p.Exists) Then _

                SAFSDEBUG "TCAFS sees TestExecute running!", DEBUG_INFO

        end if

        if (p.Exists) then

            iVerMajor = aqConvert.VarToInt(p.FileVersionInfo.MajorPart)

            iVerMinor = aqConvert.VarToInt(p.FileVersionInfo.MinorPart)

            SAFSDEBUG "TCAFS sees "& aqString.Format("Version # is: %i.%i", iVerMajor, iVerMinor), DEBUG_INFO

        end if



    Thank you VERY much for your time!



    I had started down the COM route, but now I don't have to.



    Carl Nagle

    SAS Research and Development

    Planning, Operations and Strategy

    General Applications and Tools