Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbscriptp to create txt file runs but no txt file is created

Status
Not open for further replies.

kdjonesmtb2

Technical User
Nov 19, 2012
93
US
Vbscript file runs but text file is not generated

I am using a Windows 7 Machine with Service pack 1

Where can I put some displays in to validate that the file is created?

Also I would like to use a DataTable to rather than txt

Would the code below work?

"dim x

x=DataTable.Value("sample_text",DTGlobalSheet)

tf.WriteLine($x$)"

This code executes but the file is not created

Sub CreateFile()
Dim fso, tf
Set fso = CreateObject("Scripting.FileSystemObject")
Set tf = fso.
CreateTextFile("\\ikanas267\Documents\kgittensjones\My Documents\QTP Test 834\Text files\testfile.txt", True)
print tf
' Write a line with a newline character.
tf.WriteLine("Testing 1, 2, 3.")
' Write three newline characters to the file.
tf.WriteBlankLines(3)
' Write a line.
tf.Write ("This is a test.")
tf.Close
End Sub

 
Hello,

I changed my strategy this code works:



Set fso=createobject("Scripting.FileSystemObject")
'Create a non existing file "qtptest.txt " with overwrite option as True
Set qfile1=fso.CreateTextFile("\\Documents\kgittensjones\My Documents\QTP Test 834\Text files\qtptest1.txt",true,False)
qfile1.Write((DataTable.Value("ISA_I01_Author_Info_Qualifier",dtGlobalSheet)))
qfile1.Write("*")


I am using the HP QTP testing tool which utilizes VBscript

The DataTable is an internal Excel type table that allows the input of parameters or fields

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top