1

I am using a Test Driver script (testset Driver.vbs) in QTP and in it I am trying to call a function in another file. I thought I could add this to the testset driver.vbs:

Function IncludeAOA
Dim objFSO, objFile, AR1

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile("\\Server1\QTP Files\Community\Driver Scripts\AOAReg.vbs", 1)
    AR1 = objFile.ReadAll
    objFile.Close
    ExecuteGlobal AR1
End Function

I call the IncludeAOA function which seems to work. But, when it gets to the ExecuteGlobal AR1 line it fails with an

Error: Invalid Character, Code: 800A0408.

Can anyone see what I missed?

1 Answer 1

3

AR1 - i.e. the code in AOAReg.vbs - is to blame. Try to 'run' it with cscript AOAReg.vbs. If that does not show the error (including the line number), post the code or check the encoding of that file.

Sign up to request clarification or add additional context in comments.

3 Comments

Since this was a test, I only put this in the AOAReg.vbs: Option Explicit msgbox("loaded")
@JamesCraig - Then (a) reduce further: Just ' (comment); (b) check the encoding (utf8?, bom?); (c) dump/wscript.echo/msgbox AR1.
Thanks! Looks like the file was corrupted somehow. I added the msgbox AR1 and got a couple funky characters back. So, I renamed that file and created a new one from scratch. This time it showed the text from the file! Thanks again!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.