'************************************************************************************************************************ 'Description: ' ' This example finds the add-ins associated with a specific Business component. ' If some of the necessary add-ins are not yet loaded, it loads them, restarts UFT One, opens the Business component, ' and confirms that the opened document is in fact a business component. ' '************************************************************************************************************************ Dim qtApp 'As QuickTest.Application ' Declare the Application object variable Dim arrBCAddins ' Declare the variable for storing the component's associated add-ins Dim blnNeedChangeAddins ' Declare a flag for indicating whether the component's associated add-ins are currently loaded Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object qtApp.Launch ' Start UFT One qtApp.Visible = True ' Make the UFT One application visible qtApp.TDConnection.Connect "http://qcserver/qcbin", _ "MY_DOMAIN", "My_Project", "James", "not4you", False ' Connect to ALM If qtApp.TDConnection.IsConnected Then ' If connection is successful arrBCAddins = qtApp.GetAssociatedAddinsForBC("[QualityCenter] Components\MyFolder\MyBC") ' Check if all required add-ins are all already loaded blnNeedChangeAddins = False ' Assume no change is necessary For Each bcAddin In arrBCAddins ' Iterate over the component's associated add-ins list If qtApp.Addins(bcAddin).Status <> "Active" Then ' If an associated add-in is not loaded blnNeedChangeAddins = True ' Indicate that a change in the loaded add-ins is necessary Exit For ' Exit the loop End If Next If qtApp.Launched And blnNeedChangeAddins Then qtApp.Quit ' If a change is necessary, exit UFT One to modify the loaded add-ins End If If blnNeedChangeAddins Then Dim blnActivateOK blnActivateOK = qtApp.SetActiveAddins(arrBCAddins, errorDescription) ' Load the add-ins associated with the component and check whether they load successfully. If Not blnActivateOK Then ' If a problem occurs while loading the add-ins MsgBox errorDescription ' Show a message containing the error WScript.Quit ' And end the automation program. End If End If End If If Not qtApp.Launched Then ' If UFT One is not yet open qtApp.Launch ' Start UFT One (with the correct add-ins loaded) qtApp.Visible = True ' Make the UFT One application visible qtApp.TDConnection.Connect "http://qcserver/qcbin", _ "MY_DOMAIN", "My_Project", "James", "not4you", False ' Connect to ALM End If If qtApp.TDConnection.IsConnected Then ' If connection is successful qtApp.OpenBusinessComponent "[QualityCenter] Components\MyFolder\MyBC", False ' Open the business component MsgBox qtApp.CurrentDocumentType 'Confirm that the open document is a business component End If