Search code examples
vbscriptqtphp-uft

UFT VBS Two functions same name, how do specify which one


I have a function DetermineTree() in a function library called Explorer.vbs and another function with the same name, DetermineTree(), in Datasheets.vbs. From my Action I am calling a function that will eventually call DetermineTree(). I want to specify that I want to call DetermineTree() from Explorer.vbs NOT the one from Datasheets.vbs

I realize that if i change the order the libraries are associated it will solve the issue but I am looking for a code fix to this problem.

in C# I think you can specify using dot notation, ex. Explorer.DetermineTree()


Solution

  • I assume you don't have the option of changing your function libraries to give these functions unique names (this would be the cleanest solution).

    AFAIK in VBScript a function doesn't "remember" which script file it came from, so there's no way to disambiguate these functions without changing the files. The latest file evaluated will override the previous functions with the same name.

    A hacky solution for your problem can be to use LoadFunctionLibrary before calling the function so as to ensure that the correct function library has final say as to which function to use.