Specify the Flex Applications to Open for a Record and Run Session
Source code
'************************************************************************************************************************
'Description:
'
'This example opens UFT One, loads the Web and Flex add-ins, creates a GUI test,
'and specifies the Flex applications to be opened for the test.
'
'This example assumes that there is no unsaved test currently open in UFT One.
'For more information, see the example for the Test.SaveAs method.
'************************************************************************************************************************
Dim qtApp ' Declare the Application object variable
Dim qtFlexLauncher ' Declare a Flex launcher variable

Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object

qtApp.SetActiveAddins Array("Flex", "Web") ' Load the Flex and Web Add-ins
qtApp.Launch ' Start the UFT One application
qtApp.Visible = True ' Make the UFT One application visible
qtApp.New ' Open a new test

Set qtFlexLauncher = qtApp.Test.Settings.Launchers.Item("Flex") ' Return the Flex launcher

qtFlexLauncher.Active = True ' Instruct UFT One to open specified Flex applications when a record or run session begins

' Add an AIR application to the list of applications to open. The application must be manually prepared in advance for UFT One testing.
' The application requires "Login" and "Password" command line parameters.
qtFlexLauncher.Applications.AddStandaloneApplication "C:\Program Files\MyApplication.exe", "MyName MyP@ssw0rd"

' Add a Flex application to the list of applications to open. The application must be manually prepared in advance for UFT One testing.
' The application accepts "Login" and "Password" parameters and should be opened in Internet Explorer.
qtFlexLauncher.Applications.AddApplicationInIE32 "http://myserver/MyFlexApplication.swf", "Login=MyName&Password=MyP@ssw0rd"

' Add a Flex application to open using the UFT One Flex Runtime Loader.
' The application accepts "Login" and "Password" parameters and should be opened in Internet Explorer.
' The Runtime Loader must be stored on the same server as the application.
qtFlexLauncher.Applications.AddApplicationInIE32WithRuntimeLoader "http://myserver/MyFlexApplication.swf", "Login=MyName&Password=MyP@ssw0rd", "http://myserver/UFTFlexAUTLoader.swf"

Set qtApp = Nothing 'Release the Application object
Set qtFlexLauncher = Nothing 'Release the FlexLauncher object