File System Operations
-----------------------------------------------------------------------------
'Create a Folder
Dim objFso
Set objFso=CreateObject("Scripting.FileSystemObject")
objFso.CreateFolder "C:\Documents and Settings\Administrator\Desktop\QTP"
Set objFso = Nothing
-----------------------------------------------------------------------------------------------------
'Check the existance of the Folder, If not exists then Create the Folder
Dim objFso, FolderPath
FolderPath = "C:\Documents and Settings\Administrator\Desktop\QTP"
Set objFso=CreateObject("Scripting.FileSystemObject")
If Not objFso.FolderExists(FolderPath) Then
objFso.CreateFolder FolderPath
End If
Set objFso = Nothing
------------------------------------------------------------------------------------------------
'Copy a Folder
Dim objFso, FolderPath
FolderPath = "C:\Documents and Settings\Administrator\Desktop\QTP"
Set objFso=CreateObject("Scripting.FileSystemObject")
objFso.CopyFolder FolderPath, "E:\December"
Set objFso = Nothing
-----------------------------------------------------------------------------------------------
'Delete a Folder
Dim objFso, FolderPath
FolderPath = "C:\Documents and Settings\Administrator\Desktop\QTP"
Set objFso=CreateObject("Scripting.FileSystemObject")
objFso.DeleteFolder FolderPath
Set objFso = Nothing
----------------------------------------------------------------------------------------
'Chcek the existance of the Folder, If Exists then Delete the Folder
Dim objFso, FolderPath
FolderPath = "C:\Documents and Settings\Administrator\Desktop\QTP"
Set objFso=CreateObject("Scripting.FileSystemObject")
If objFso.FolderExists(FolderPath) Then
objFso.DeleteFolder FolderPath
End If
Set objFso = Nothing
-------------------------------------------------------------------------------------------------------
'Create a Text file
Dim objFso
Set objFso = CreateObject ("Scripting.FileSystemObject")
objFso.CreateTextFile ("C:\Documents and Settings\Administrator\Desktop\QTP.txt")
objFso.CreateTextFile ("C:\Documents and Settings\Administrator\Desktop\QTP.doc")
objFso.CreateTextFile ("C:\Documents and Settings\Administrator\Desktop\QTP.xls")
objFso.CreateTextFile ("C:\Documents and Settings\Administrator\Desktop\QTP.pdf")
Set objFso = Nothing
-------------------------------------------------------------------------------------------------------------------
'Find Size of a Text file
Dim objFso, FileSize
Set objFso = CreateObject ("Scripting.FileSystemObject")
FileSize = objFso.GetFile("C:\Documents and Settings\Administrator\Desktop\QTP.txt").Size
Msgbox FileSize & " Bytes"
Set objFso = Nothing
-----------------------------------------------------------------------------------------------------------------------
'Delete a Text file
Dim objFso
Set objFso = CreateObject ("Scripting.FileSystemObject")
objFso.DeleteFile("C:\Documents and Settings\Administrator\Desktop\QTP.txt")
Set objFso = Nothing
--------------------------------------------------------------------------------------------------------------
Text Related Operations
-----------------------------
'Read a Text file Char by Char
Dim objFso, objTextStream, myChar
Set objFso = CreateObject ("Scripting.FileSystemObject")
Set objTextStream=objFso.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\QTP.txt")
Do While objTextStream.AtEndOfStream = False
myChar=objTextStream.Read(1)
msgbox myChar
Loop
objTextStream.Close
Set objTextStream = Nothing
Set objFso = Nothing
----------------------------------------------------------------------------------------------------------------
'Read a Text file Line by Line
Dim objFso, objTextStream, myLine
Set objFso = CreateObject ("Scripting.FileSystemObject")
Set objTextStream=objFso.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\QTP.txt")
Do Until objTextStream.AtEndOfStream = True
myLine=objTextStream.ReadLine
msgbox myLine
Loop
objTextStream.Close
Set objTextStream = Nothing
Set objFso = Nothing
----------------------------------------------------------------------------------------------------------------
'Read a Text file (Read All)
Dim objFso, objTextStream, myContent
Set objFso = CreateObject ("Scripting.FileSystemObject")
Set objTextStream=objFso.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\Nov2011.txt")
myContent = objTextStream.ReadAll
Print myContent
objTextStream.Close
Set objTextStream = Nothing
Set objFso = Nothing
-----------------------------------------------------------------------------------------------------
'Data driven Testing for Login Operation by fetching Test data directly from a Text file.
Dim objFso, objTextstream, myLine, myField
Set objFso=CreateObject("Scripting.FileSystemObject")
Set objTextstream = objFso.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\QTP.txt", 1)' 1 for read, 2 for write, 8 for Append
objTextstream.SkipLine
While objTextstream.AtEndOfStream = False
myLine=objTextstream.ReadLine
myField = Split (myLine,", ")
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("text:=Login").Activate
Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Set myField(0)
Dialog("text:=Login").WinEdit("attached text:=Password:").Set myField(1)
Wait 1
Dialog("text:=Login").WinButton("text:=OK").Click
Window("text:=Flight Reservation").Close
Wend
objTextstream.Close
Set objTextstream = Nothing
Set objFso=Nothing
-------------------------------------------------------------------------------------------
'Data driven Testing for Login Operation by fetching Test data directly from a Text file.
Dim objFso, objTextstream, myLine, myField, LineCount
Set objFso=CreateObject("Scripting.FileSystemObject")
Set objTextstream = objFso.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\QTP.txt", 1)' 1 for read, 2 for write, 8 for Append
LineCount=0
While objTextstream.AtEndOfStream = False
myLine=objTextstream.ReadLine
LineCount=LineCount+1
If LineCount >= 4 And LineCount <= 8 Then
myField = Split (myLine,", ")
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("text:=Login").Activate
Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Set myField(0)
Dialog("text:=Login").WinEdit("attached text:=Password:").Set myField(1)
Wait 1
Dialog("text:=Login").WinButton("text:=OK").Click
Window("text:=Flight Reservation").Close
End If
Wend
objTextstream.Close
Set objTextstream = Nothing
Set objFso=Nothing
----------------------------------------------------------------------------------------------------------------
'Write Data to a text file
Dim objFso, objTextstream, num1, num2, sum
num1=100 : num2= 200 : sum=num1+num2
Set objFso=CreateObject("Scripting.FileSystemObject")
Set objTextstream = objFso.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\QTP.txt", 2)
objTextstream.Write "Addition of num1, num2 is: "& sum
objTextstream.Close
Set objTextstream = Nothing
Set objFso=Nothing
------------------------------------------------------------------------------------------
'Read Button Names from Login dialog box and export to a text file
Dim objFso, objTextstream
Dim oButton, Buttons, i, Button_Name
Set objFso= CReateObject("Scripting.FileSystemObject")
Set objTextstream= objFso.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\QTP.txt", 2)
objTextstream.WriteLine "Button Names"
objTextstream.WriteLine "-------------"
Set oButton = Description.Create
oButton("Class Name").Value= "WinButton"
Set Buttons = Dialog("text:=Login").ChildObjects(oButton)
For i= 0 to Buttons.Count - 1 Step 1
Button_Name=Buttons(i).GetRoProperty("text")
objTextstream.WriteLine Button_Name
Next
objTextstream.Close
Set objTextstream = Nothing
Set objFso=Nothing
------------------------------------------------------------------------------------
'Read Link Names and URLs from Deals direct web portal and export to a text file
Dim objFso, objTextstream
Dim oLink, Links, i, Link_Name, url
Set objFso= CReateObject("Scripting.FileSystemObject")
Set objTextstream= objFso.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\QTP.txt", 2)
objTextstream.WriteLine "Link Names"
objTextstream.WriteLine "-------------"
Set oLink = Description.Create
oLink("micclass").Value= "Link"
Set Links = Browser("Christmas Lights Online").Page("Online Shopping | Australia").ChildObjects(oLink)
sno=0
For i= 0 to Links.Count - 1 Step 1
Link_Name=Links(i).GetRoProperty("text")
sno=sno+1
url=Links(i).GetRoProperty("url")
objTextstream.WriteLine sno &") "& Link_Name &" "&url
Next
objTextstream.Close
Set objTextstream = Nothing
Set objFso=Nothing
------------------------------------------------------------------------------------------------------------------
'Read Order numbers and customer Names from 1 to 10 Orders in FR window and export to a Text file
Dim objFso, objTextstream, OrderNo, C_Name
Set objFso= CReateObject("Scripting.FileSystemObject")
Set objTextstream= objFso.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\QTP.txt", 2)
objTextstream.WriteLine "OrderNo C_Name"
objTextstream.WriteLine "--------------"
For i= 1 to 10
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set i
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
OrderNo = Window("Flight Reservation").WinEdit("Order No:").GetROProperty("text")
C_Name = Window("Flight Reservation").WinEdit("Name:").GetROProperty("text")
objTextstream.WriteLine OrderNo&", "&C_Name
Next
objTextstream.Close
Set objTextstream = Nothing
Set objFso=Nothing
---------------------------------------------------------------------------------------------------------------------
'Find Length of a String/Number without using Len Function
Dim val, objFso, objTextstream, val_Legnth
Set objFso= CreateObject("Scripting.FileSystemObject")
val=InputBox ("Enter a value")
Set objTextstream = objFso.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\sample.txt", 2)
objTextstream.Write val
objTextstream.Close
val_Legnth=objFso.GetFile("C:\Documents and Settings\Administrator\Desktop\sample.txt").Size
Msgbox val_Legnth &" Characters"
Set objTextstream=Nothing
Set objFso=Nothing
------------------------------------------------------------------------------------------------------------
'Compare two text files by Size, by Text, and by Binary values
Dim objFso, File1, File2, objTextstream1, objTextstream2, Content1, Content2
File1="C:\Documents and Settings\Administrator\Desktop\QTP.txt"
File2="C:\Documents and Settings\Administrator\Desktop\sample.txt"
Set objFso=CreateObject("Scripting.FileSystemObject")
'Compare two text files by Size
If objFso.GetFile(File1).Size = objFso.GetFile(File2).Size Then
Msgbox "Files are same in Size"
Else
Msgbox "Files are Not same in Size"
End If
'Compare two text files by Text
Set objTextstream1= objFso.OpenTextFile(File1)
Set objTextstream2= objFso.OpenTextFile(File2)
Content1=objTextstream1.ReadAll
Content2=objTextstream2.ReadAll
If StrComp(Content1, Content2, 1)=0 Then
Msgbox "Files are having Same Text"
Else
Msgbox "Files are having Different Text"
End If
'Compare two text files by Binary values
If StrComp(Content1, Content2)=0 Then
Msgbox "Files are Same"
Else
Msgbox "Files are Different"
End If
objTextstream1.Close
objTextstream2.Close
Set objTextstream1 = Nothing
Set objTextstream2 = nothing
Set objFso=Nothing
------------------------------------------------------------------------------------------------------------------
Dim fso,x,i
Set fso = CreateObject("Scripting.FileSystemObject")
Set f=fso.CreateTextFile("C:\FlyfromData.txt")
n=Window("Flight Reservation").WinComboBox("Fly From:").GetItemsCount
msgbox n
For i= 0 to n-1 step 1
x= Window("Flight Reservation").WinComboBox("Fly From:").GetItem(i)
f.writeline(x)
Next
f.close
Set fso = nothing
open text file:
----------------
Denver
Frankfurt
London
Los Angeles
Paris
Portland
San Francisco
Seattle
Sydney
Zurich
----------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------
'Create a Folder
Dim objFso
Set objFso=CreateObject("Scripting.FileSystemObject")
objFso.CreateFolder "C:\Documents and Settings\Administrator\Desktop\QTP"
Set objFso = Nothing
-----------------------------------------------------------------------------------------------------
'Check the existance of the Folder, If not exists then Create the Folder
Dim objFso, FolderPath
FolderPath = "C:\Documents and Settings\Administrator\Desktop\QTP"
Set objFso=CreateObject("Scripting.FileSystemObject")
If Not objFso.FolderExists(FolderPath) Then
objFso.CreateFolder FolderPath
End If
Set objFso = Nothing
------------------------------------------------------------------------------------------------
'Copy a Folder
Dim objFso, FolderPath
FolderPath = "C:\Documents and Settings\Administrator\Desktop\QTP"
Set objFso=CreateObject("Scripting.FileSystemObject")
objFso.CopyFolder FolderPath, "E:\December"
Set objFso = Nothing
-----------------------------------------------------------------------------------------------
'Delete a Folder
Dim objFso, FolderPath
FolderPath = "C:\Documents and Settings\Administrator\Desktop\QTP"
Set objFso=CreateObject("Scripting.FileSystemObject")
objFso.DeleteFolder FolderPath
Set objFso = Nothing
----------------------------------------------------------------------------------------
'Chcek the existance of the Folder, If Exists then Delete the Folder
Dim objFso, FolderPath
FolderPath = "C:\Documents and Settings\Administrator\Desktop\QTP"
Set objFso=CreateObject("Scripting.FileSystemObject")
If objFso.FolderExists(FolderPath) Then
objFso.DeleteFolder FolderPath
End If
Set objFso = Nothing
-------------------------------------------------------------------------------------------------------
'Create a Text file
Dim objFso
Set objFso = CreateObject ("Scripting.FileSystemObject")
objFso.CreateTextFile ("C:\Documents and Settings\Administrator\Desktop\QTP.txt")
objFso.CreateTextFile ("C:\Documents and Settings\Administrator\Desktop\QTP.doc")
objFso.CreateTextFile ("C:\Documents and Settings\Administrator\Desktop\QTP.xls")
objFso.CreateTextFile ("C:\Documents and Settings\Administrator\Desktop\QTP.pdf")
Set objFso = Nothing
-------------------------------------------------------------------------------------------------------------------
'Find Size of a Text file
Dim objFso, FileSize
Set objFso = CreateObject ("Scripting.FileSystemObject")
FileSize = objFso.GetFile("C:\Documents and Settings\Administrator\Desktop\QTP.txt").Size
Msgbox FileSize & " Bytes"
Set objFso = Nothing
-----------------------------------------------------------------------------------------------------------------------
'Delete a Text file
Dim objFso
Set objFso = CreateObject ("Scripting.FileSystemObject")
objFso.DeleteFile("C:\Documents and Settings\Administrator\Desktop\QTP.txt")
Set objFso = Nothing
--------------------------------------------------------------------------------------------------------------
Text Related Operations
-----------------------------
'Read a Text file Char by Char
Dim objFso, objTextStream, myChar
Set objFso = CreateObject ("Scripting.FileSystemObject")
Set objTextStream=objFso.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\QTP.txt")
Do While objTextStream.AtEndOfStream = False
myChar=objTextStream.Read(1)
msgbox myChar
Loop
objTextStream.Close
Set objTextStream = Nothing
Set objFso = Nothing
----------------------------------------------------------------------------------------------------------------
'Read a Text file Line by Line
Dim objFso, objTextStream, myLine
Set objFso = CreateObject ("Scripting.FileSystemObject")
Set objTextStream=objFso.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\QTP.txt")
Do Until objTextStream.AtEndOfStream = True
myLine=objTextStream.ReadLine
msgbox myLine
Loop
objTextStream.Close
Set objTextStream = Nothing
Set objFso = Nothing
----------------------------------------------------------------------------------------------------------------
'Read a Text file (Read All)
Dim objFso, objTextStream, myContent
Set objFso = CreateObject ("Scripting.FileSystemObject")
Set objTextStream=objFso.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\Nov2011.txt")
myContent = objTextStream.ReadAll
Print myContent
objTextStream.Close
Set objTextStream = Nothing
Set objFso = Nothing
-----------------------------------------------------------------------------------------------------
'Data driven Testing for Login Operation by fetching Test data directly from a Text file.
Dim objFso, objTextstream, myLine, myField
Set objFso=CreateObject("Scripting.FileSystemObject")
Set objTextstream = objFso.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\QTP.txt", 1)' 1 for read, 2 for write, 8 for Append
objTextstream.SkipLine
While objTextstream.AtEndOfStream = False
myLine=objTextstream.ReadLine
myField = Split (myLine,", ")
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("text:=Login").Activate
Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Set myField(0)
Dialog("text:=Login").WinEdit("attached text:=Password:").Set myField(1)
Wait 1
Dialog("text:=Login").WinButton("text:=OK").Click
Window("text:=Flight Reservation").Close
Wend
objTextstream.Close
Set objTextstream = Nothing
Set objFso=Nothing
-------------------------------------------------------------------------------------------
'Data driven Testing for Login Operation by fetching Test data directly from a Text file.
Dim objFso, objTextstream, myLine, myField, LineCount
Set objFso=CreateObject("Scripting.FileSystemObject")
Set objTextstream = objFso.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\QTP.txt", 1)' 1 for read, 2 for write, 8 for Append
LineCount=0
While objTextstream.AtEndOfStream = False
myLine=objTextstream.ReadLine
LineCount=LineCount+1
If LineCount >= 4 And LineCount <= 8 Then
myField = Split (myLine,", ")
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("text:=Login").Activate
Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Set myField(0)
Dialog("text:=Login").WinEdit("attached text:=Password:").Set myField(1)
Wait 1
Dialog("text:=Login").WinButton("text:=OK").Click
Window("text:=Flight Reservation").Close
End If
Wend
objTextstream.Close
Set objTextstream = Nothing
Set objFso=Nothing
----------------------------------------------------------------------------------------------------------------
'Write Data to a text file
Dim objFso, objTextstream, num1, num2, sum
num1=100 : num2= 200 : sum=num1+num2
Set objFso=CreateObject("Scripting.FileSystemObject")
Set objTextstream = objFso.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\QTP.txt", 2)
objTextstream.Write "Addition of num1, num2 is: "& sum
objTextstream.Close
Set objTextstream = Nothing
Set objFso=Nothing
------------------------------------------------------------------------------------------
'Read Button Names from Login dialog box and export to a text file
Dim objFso, objTextstream
Dim oButton, Buttons, i, Button_Name
Set objFso= CReateObject("Scripting.FileSystemObject")
Set objTextstream= objFso.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\QTP.txt", 2)
objTextstream.WriteLine "Button Names"
objTextstream.WriteLine "-------------"
Set oButton = Description.Create
oButton("Class Name").Value= "WinButton"
Set Buttons = Dialog("text:=Login").ChildObjects(oButton)
For i= 0 to Buttons.Count - 1 Step 1
Button_Name=Buttons(i).GetRoProperty("text")
objTextstream.WriteLine Button_Name
Next
objTextstream.Close
Set objTextstream = Nothing
Set objFso=Nothing
------------------------------------------------------------------------------------
'Read Link Names and URLs from Deals direct web portal and export to a text file
Dim objFso, objTextstream
Dim oLink, Links, i, Link_Name, url
Set objFso= CReateObject("Scripting.FileSystemObject")
Set objTextstream= objFso.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\QTP.txt", 2)
objTextstream.WriteLine "Link Names"
objTextstream.WriteLine "-------------"
Set oLink = Description.Create
oLink("micclass").Value= "Link"
Set Links = Browser("Christmas Lights Online").Page("Online Shopping | Australia").ChildObjects(oLink)
sno=0
For i= 0 to Links.Count - 1 Step 1
Link_Name=Links(i).GetRoProperty("text")
sno=sno+1
url=Links(i).GetRoProperty("url")
objTextstream.WriteLine sno &") "& Link_Name &" "&url
Next
objTextstream.Close
Set objTextstream = Nothing
Set objFso=Nothing
------------------------------------------------------------------------------------------------------------------
'Read Order numbers and customer Names from 1 to 10 Orders in FR window and export to a Text file
Dim objFso, objTextstream, OrderNo, C_Name
Set objFso= CReateObject("Scripting.FileSystemObject")
Set objTextstream= objFso.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\QTP.txt", 2)
objTextstream.WriteLine "OrderNo C_Name"
objTextstream.WriteLine "--------------"
For i= 1 to 10
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set i
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
OrderNo = Window("Flight Reservation").WinEdit("Order No:").GetROProperty("text")
C_Name = Window("Flight Reservation").WinEdit("Name:").GetROProperty("text")
objTextstream.WriteLine OrderNo&", "&C_Name
Next
objTextstream.Close
Set objTextstream = Nothing
Set objFso=Nothing
---------------------------------------------------------------------------------------------------------------------
'Find Length of a String/Number without using Len Function
Dim val, objFso, objTextstream, val_Legnth
Set objFso= CreateObject("Scripting.FileSystemObject")
val=InputBox ("Enter a value")
Set objTextstream = objFso.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\sample.txt", 2)
objTextstream.Write val
objTextstream.Close
val_Legnth=objFso.GetFile("C:\Documents and Settings\Administrator\Desktop\sample.txt").Size
Msgbox val_Legnth &" Characters"
Set objTextstream=Nothing
Set objFso=Nothing
------------------------------------------------------------------------------------------------------------
'Compare two text files by Size, by Text, and by Binary values
Dim objFso, File1, File2, objTextstream1, objTextstream2, Content1, Content2
File1="C:\Documents and Settings\Administrator\Desktop\QTP.txt"
File2="C:\Documents and Settings\Administrator\Desktop\sample.txt"
Set objFso=CreateObject("Scripting.FileSystemObject")
'Compare two text files by Size
If objFso.GetFile(File1).Size = objFso.GetFile(File2).Size Then
Msgbox "Files are same in Size"
Else
Msgbox "Files are Not same in Size"
End If
'Compare two text files by Text
Set objTextstream1= objFso.OpenTextFile(File1)
Set objTextstream2= objFso.OpenTextFile(File2)
Content1=objTextstream1.ReadAll
Content2=objTextstream2.ReadAll
If StrComp(Content1, Content2, 1)=0 Then
Msgbox "Files are having Same Text"
Else
Msgbox "Files are having Different Text"
End If
'Compare two text files by Binary values
If StrComp(Content1, Content2)=0 Then
Msgbox "Files are Same"
Else
Msgbox "Files are Different"
End If
objTextstream1.Close
objTextstream2.Close
Set objTextstream1 = Nothing
Set objTextstream2 = nothing
Set objFso=Nothing
------------------------------------------------------------------------------------------------------------------
Dim fso,x,i
Set fso = CreateObject("Scripting.FileSystemObject")
Set f=fso.CreateTextFile("C:\FlyfromData.txt")
n=Window("Flight Reservation").WinComboBox("Fly From:").GetItemsCount
msgbox n
For i= 0 to n-1 step 1
x= Window("Flight Reservation").WinComboBox("Fly From:").GetItem(i)
f.writeline(x)
Next
f.close
Set fso = nothing
open text file:
----------------
Denver
Frankfurt
London
Los Angeles
Paris
Portland
San Francisco
Seattle
Sydney
Zurich
----------------------------------------------------------------------------------------------------------------
No comments
Post a Comment