04-13-2012, 03:38 PM
I executed the following block of code from two machines(having QTP11).
(DataFilePath.txt is created inside C Drive and the path written in this file is :- " C:\Datasheet\ ")
The line "print str_ImportedDataFilePath" is producing output in single line in one machine and in two lines in another machine. The outputs are:
Machine1: C:\Datasheet\
NewExcel.xls
Machine2: C:\Datasheet\NewExcel.xls
I use this code to import datasheet from some location in my machine.
The parent location path of the datasheet is provided in DataFilePath.txt
When I'm executing this code from Machine2, it's working fine.
But When I'm executing this code from Machine1 It's showing Error in importing file as the path is not a single line.
I don't understand what to do here. Is this any setting issue or some problem is there in the QTP present in Machine1?
Please help me in overcoming this issue.
Thanks in advance,
Bdash
Code:
str_ImportedDataFileName="NewExcel.xls"
Set fso = CreateObject("Scripting.FileSystemObject")
Set FilePath=fso.OpenTextFile("C:\DataFilePath.txt",1)
str_Path=FilePath.Read(30)
str_ImportedDataFilePath=trim(str_Path) + str_ImportedDataFileName
print str_ImportedDataFilePath
(DataFilePath.txt is created inside C Drive and the path written in this file is :- " C:\Datasheet\ ")
The line "print str_ImportedDataFilePath" is producing output in single line in one machine and in two lines in another machine. The outputs are:
Machine1: C:\Datasheet\
NewExcel.xls
Machine2: C:\Datasheet\NewExcel.xls
I use this code to import datasheet from some location in my machine.
The parent location path of the datasheet is provided in DataFilePath.txt
When I'm executing this code from Machine2, it's working fine.
But When I'm executing this code from Machine1 It's showing Error in importing file as the path is not a single line.
I don't understand what to do here. Is this any setting issue or some problem is there in the QTP present in Machine1?
Please help me in overcoming this issue.
Thanks in advance,
Bdash