cancel
Showing results for 
Search instead for 
Did you mean: 

[TechCorner Challenge #3] - Changing the options from outside of TestComplete

SOLVED
Highlighted
Community Leader

Re: [TechCorner Challenge #3] - Changing the options from outside of TestComplete

I have a guy in the company who changes my option when I call him, does that count?

Community Manager

Re: [TechCorner Challenge #3] - Changing the options from outside of TestComplete

@Wamboo not everybody is as lucky😁


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Community Manager

Changing the options from outside of TestComplete

Task: Create a script that changes TestComplete options from outside of TestComplete

 

This is a solution created for [TechCorner Challenge #3]

 

Hi All,

I always try to find some time for coding. Recently, I've started learning VBA to create macros in Excel 😎 

 

So, here is a sample of how to read TestComplete settings from a setting file. However, I would like to mention that the structure of the setting file isn't documented and, thus, it can be changed from version to version. It's always better to use TestComplete/TestExecute UI to change settings.

 

Anyway, here is a VBScript code. Please feel free to post your comments.

 

 

 

Sub readTCsettings

  Dim Doc, localappdata, path, jvmSetting, newJvmPath
   
  'get a path to local settings
  localappdata = WshShell.ExpandEnvironmentStrings("%LOCALAPPDATA%")
  
  'get an object to work with XML
  Set Doc = Sys.OleObject("Msxml2.DOMDocument.6.0")
  
  'make sure that we can read a hidden file
  Call Doc.setProperty("ProhibitDTD", false)
  
  Doc.async = false
  path = localappdata + "\SmartBear\TestComplete\14.0\tcSettings.xml"
  
  'load the xml settings file
  Doc.load(path)
  
  'get the node with settings
  Set jvmSetting = Doc.selectNodes("//Node[@name='{2e030b0e-f461-47e8-980a-56851ef43cff}']/Node[@name='{291fd292-a44f-4b82-9232-e8899ca6c851}']/Prp[@name='value']")
  
  if jvmSetting.length = 0 Then
    Log.Message ("JVM setting wasn't found")
  
  Else
    'log the value of the setting
    Log.Message ("Current JVM settings: " & jvmSetting(0).getAttribute("value"))
  
  End If
  
End Sub

 

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

Tags (1)
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors