cancel
Showing results for 
Search instead for 
Did you mean: 

TC/TE VBScript Runtime Version information

SOLVED
Highlighted
New Contributor

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

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

RE: TC/TE VBScript Runtime Version information

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))

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

3 REPLIES 3
Highlighted
Community Hero

RE: TC/TE VBScript Runtime Version information

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))

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

Highlighted
New Contributor

RE: TC/TE VBScript Runtime Version information

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
Highlighted
Community Hero

RE: TC/TE VBScript Runtime Version information

Glad it helped 🙂

Thank you for the update, Carl.
Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors