Forum Discussion

jorgesimoes1983's avatar
jorgesimoes1983
Regular Contributor
10 years ago

Create registry keys TestComplete configuration

I created this thread to share with you two functions I believe they will be as useful as they were to me.



TestComplete recommends setting two different keys in the registry, one for remote desktop and other for internet explorer processes control, so here it goes.








/**

 * Adiciona chave ao registry para permitir trabalhar com TestComplete remotamente

 * cria chave HKEY_CURRENT_USER\\Software\\Microsoft\\Terminal Server Client\\RemoteDesktop_SuppressWhenMinimized

 * com valor = 2

 * @method Registry_RemoteDesktop_SuppressWhenMinimized

 */

function Registry_RemoteDesktop_SuppressWhenMinimized()

{

  var Key, Value, ValueName;

  // Gets an object for the Windows system registry key

  Key = Storages.Registry("Software\\Microsoft\\Terminal Server Client", HKEY_CURRENT_USER, AQRT_32_BIT);

  // Specifies the name of the value you want to obtain

  ValueName = "RemoteDesktop_SuppressWhenMinimized";



  // Checks whether the value exists

  if (Key.OptionExists(ValueName))

  {

    // If the value exists, posts it to the test log

    Value = Key.GetOption(ValueName, "not specified");

    Log.Message("Já existe > "+ValueName + ": " + Value);

  }

  else

  {

    Log.Warning("The " + ValueName + " value does not exist and will be created.");      

          

    var WSObj = Sys.OleObject("WScript.Shell");

    WSObj.RegWrite ("HKEY_CURRENT_USER\\Software\\Microsoft\\Terminal Server Client\\RemoteDesktop_SuppressWhenMinimized", 2, "REG_DWORD");

  }

}








/**

 * Adiciona chave ao registry para permitir trabalhar com TestComplete remotamente

 * cria chave HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Main\\TabProcGrowth

 * @method Registry_TabProcGrowth

 * Param valor {integer} valor da chave, deve ser 0 ou 1

 */

function Registry_TabProcGrowth(valor)

{

  if(valor==undefined)valor = 0;



  var Key, Value, ValueName;

  // Gets an object for the Windows system registry key

  Key = Storages.Registry("Software\\Microsoft\\Internet Explorer\\Main", HKEY_CURRENT_USER, AQRT_32_BIT);

  // Specifies the name of the value you want to obtain

  ValueName = "TabProcGrowth";



  // Checks whether the value exists

  if (Key.OptionExists(ValueName))

  {

    // If the value exists, posts it to the test log

    Value = Key.GetOption(ValueName, "not specified");

    Log.Message("Já existe > "+ValueName + ": " + Value);

    Log.Message("Escreve por cima > "+ValueName + ": " + valor);

          

    var WSObj = Sys.OleObject("WScript.Shell");

    WSObj.RegWrite ("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Main\\TabProcGrowth", valor, "REG_DWORD");

  }

}