Micro Focus QTP (UFT) Forums

Full Version: associate vbs
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi
can we associte vbs at runtime
basicaly my requirement is to implement case statement
case select var
case "A"
associate vbs a
case "B"
associate vbs b
end select

i dont want to use executefile as it does not provide ood debugging mechansm and also on some error it points to some other line of the code

also associating vbs using test->settings (manully) => loads all vbs at before the actual code execution start and makes us wait for long
Hi,

If you want to associate vbs before the QTP Application is launched, you can do it in following way.

Code:
Set App = CreateObject("QuickTest.Application")
App.Launch
App.Visible = True
App.Test.Settings.Resources.Libraries.RemoveAll
var  = "A"
Select case var
    case "A":App.Test.Settings.Resources.Libraries.Add "D:\A.vbs"
    case "B":App.Test.Settings.Resources.Libraries.Add "D:\b.vbs"
End Select
Set App = Nothing
This functionality is added in QTP 11 now Check the new features of QTP 11 here