Hi,
this is venkatesh.
Q: I have 10 files in a folder(say D:\). Out of which there
are some .txt, .xls, .doc. I want to know how to get the
count of each file using qtp?
If U have any ans, plz write script for that...
Answers were Sorted based on User's Feedback
Answer / bathi
set fso=createobject("scripting.filesystemobject")
set objfolder=fso.getfolder("XXX")
set fil=objfolder.files
for each fils in fil
fils1=fils1&fils.name
next
xls=split(fils1,".xls")
msgbox ubound(xls)
doc=split(fils1,".doc")
msgbox ubound(doc)
txt=split(fils1,".txt")
msgbox ubound(txt)
I guess, this will work........
Good Day........
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / balu
Dim filesys, demofolder, fil, filecoll, filist, ctr1, ctr2, ctr3
ctr1 = 0
ctr2 = 0
ctr3 = 0
Set filesys = CreateObject("Scripting.FileSystemObject")
Set demofolder = filesys.GetFolder("c:\QTPtest")
Set filecoll = demofolder.Files
For Each fil in filecoll
If filesys.getExtensionName("c:\QTPtest\" & fil.Name) =
"txt" Then
ctr1 = ctr1+1
End If
If filesys.getExtensionName("c:\QTPtest\" & fil.Name) =
"xls" Then
ctr2 = ctr2+1
End If
If filesys.getExtensionName("c:\QTPtest\" & fil.Name) =
"doc" Then
ctr3 = ctr3+1
End If
'filist = fil.name
'filist = filist & " "
Next
msgbox("The count for Text files is: " & ctr1 & " The count
for Excel files is: " & ctr2 &" The count for Word files
is: " & ctr3 )
take and pandugachesukoooo....(if you r tulugu people you
can understood pandu... cool)
Is This Answer Correct ? | 4 Yes | 1 No |
Answer / tvs ramakrishna chowdary
Dim filesys, demofolder, fil, filecoll, filist, ctr1, ctr2,
ctr3
ctr1 = 0
ctr2 = 0
ctr3 = 0
Set filesys = CreateObject("Scripting.FileSystemObject")
Set demofolder = filesys.GetFolder("E:\mk")
Set filecoll = demofolder.Files
For Each fil in filecoll
x= fil.name
If filesys.getExtensionName("E:\mkt\" &x) = "txt"
Then
ctr1 = ctr1+1
msgbox "total text files:"&ctr1
End If
If filesys.getExtensionName("E:\mkt\" &x) ="xls"
Then
ctr2 = ctr2+1
msgbox "total excel files are:"&ctr2
End If
If filesys.getExtensionName("E:\mkt\" &x) ="doc"
Then
ctr3 = ctr3+1
msgbox "total word files are:"&ctr3
End If
msgbox x
Next
msgbox("The count for Text files is: " & ctr1 & " The
countfor Excel files is: " & ctr2 &" The count for Word
files is: " & ctr3 )
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / chowdary
hi balu and bathi good work .........
thnks........
Is This Answer Correct ? | 0 Yes | 4 No |
how do u create new test sets in TD
key word driven frame work is like a folder structure Question is that where is the folder like funtion library folder,object repository,data base,application scenerio folder etc are store whether in a remote machine where we have to access or in our machine (it just like VSS)
In Descriptive programing if i use this below code will it work for login window or flight Res Window. Shud i add the properties like attached text=login and text=Agent Name in the object repository and define a new object first. Pls tell me the procedure in clear inorder to execute this script. Dialog("title:=Login").WinEdit("attached text:=Agent Name:").set"agent123" Dialog("title:=Login").WinEdit("attached text:=Password:").set"mercury" Dialog("attached text:=Login").winbutton("text:=OK").click
Why do we use text checkpoint as we can make use of the same in the standard check point?
write progamming connecting QTP to database sql? this is question asked by interview? pls any answer this?
What are the main differences of qtp and win runner?
What is the standard timing delay for web based application in qtp?
Suppose I want to use Index value of "WinEdit" in my script .But it is showing None in "Ordinal identifier" value of Testobject Details in the Object Repository.How to enable Ordinal Identifiers to capture the Index value of that particular WinEdit. I have selected "index" and clicked "OK" from Tools-> Object Identification Again I added same WinEdit to the Object repository But I did not get Index value..Please any one help me.How to enable Ordinal indentifiers
desribe a situation where u faced a stressful situation and how did u cope with it
Scripts for Ascending order in qtp.
When we r doing data driven test with chkpts, i want to insert formulae in data sheet but i didn't get. How we wil do that plz. explain in detail.
Hi, is it possible for recording shortcut key during record session? The application on which I am working is web based application. This application has several shortcut key associated with menu option. I have succesfully recorded all menu option but unable to record shortcut key.