I have two scripts.
In ScriptA, the root action Action1 calls ActionA, which is a nested reusable action.
In ScriptB, the root action Action2 calls Action1.

In ActionA,I write data to a file "..\TestResult.txt" as follow:
Set f = fso.OpenTextFile("..\TestResult.txt",8,true)

the file path is shown as followsTestResult.txt is located in the directory where the ScriptA and ScriptB is located)

when I run ScriptA, the file is correctly located.
But when I run ScriptB, when it calls Action1 and then ActionA, the file is located to the QTP installation dir(C:\Program Files\Mercury Interactive\QuickTest Professional)

I have add the direcotry which "TestResult.txt" is located to Tools->Options->Folders, and put it to the top in the list, but it still fails, it still writes to the file "TestResult.txt" under C:\Program Files\Mercury Interactive\QuickTest Professional

It is strange that in the same reusable action ActionA, there are some other file located, like
ExecuteFile "..\..\Global.vbs"
Datatable.ImportSheet "..\TestCase.xls",Parameter("SheetSource"),CInt(Pa rameter("SheetDest"))
They all work correctly(the correct path is located), but only in this textfile locating, it fails.

How to resolve this?

In my script, there is a call to the command prompt window, oShell.run"cmd.exe"
In my previous test, when the prompt window is opened, the default current path is the directory where the test is located, but now it is "C:\Program Files\Mercury Interactive\QuickTest Professional\bin", while it is also the default setting when add a path in Tools->Options->Folders. How to change the current directory?
(I checked Test->Setting->Environment, and found that the TestDir is correct, it is the directory where the test is located)

[ 03-15-2006, 02:01 AM: Message edited by: oliviabean ]