Friday, February 5, 2010

PROGRAM-21

reding subfolder in specified folder
Function getfolder (fdrname)
Set fso=createobject ("scripting.filesystemobject")
Set fdr=fso.getfolder(fdrname)
Set frd=fdr.subfolders
If frd.count >0 Then
For each fd in frd
print(fdname & "\" & fd.name)
Next
End If
End Function
getfolder "E:\"

PROGRAM-20

print files in a folder
Set fso=createobject ("scripting.filesystemobject")
Set fdo=fso.getfolder("E:\biswa")
Set flsc=fdo.files
print("no of files:"& flsc.count)
For each fl in flsc
print (fl.name)
Next

PROGRAM-19

program for reading folders name in folders
Set fso=createobject ("scripting.filesystemobject")
Set ts=fso.getfolder("E:\biswa")
Set fdr=ts.subfolders
For each fd in fdr
print (fd.name)
Next
print("over")

PROGRAM-18

PROGRAM FOR READING A FILE
Set fso=createobject ("scripting.filesystemobject")
Set ts=fso.opentextfile("E:\biswa\demo.txt")
While not ts.atendofstream
l=ts.readline()
print(l)

PROGRAM-17

WORKING WITH FLIGHT SIMULATOR DATABASE
-------------------------------------------------------
Set db=createobject("ADODB.connection")
db.open "dsn=qt_flight32"
If db.state = 1 Then
msgbox("connected")'
exit test
end if
Set rs=db.execute("select * from Orders")
cc=rs.fields.count
While not rs.eof
rw=""
For i=0 to cc-1
celldata=rs.fields(i).value
rw=rw & vbtab & celldata
Next
print(rw)
rs.movenext
Wend

PROGRAM-16

FINDORDER NUMBER IN RUNTIME
---------------------------------------------
Window("Flight Reservation").Activate
Window("Flight Reservation").WinObject("Date of Flight:").Type "1111111"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Denver"
Window("Flight Reservation").WinComboBox("Fly To:").Select "Paris"
Window("Flight Reservation").WinButton("FLIGHT").ClickWindow("Flight Reservation").Dialog("Flights Table").WinList("From").Select "15835 DEN 12:48 PM PAR 02:48 PM AF $165.60"
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set "hi"Window("Flight Reservation").WinButton("Insert Order").Click
Window("Flight Reservation").ActivateWindow("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").Dialog("Open Order").Click 29,155Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Output CheckPoint("Edit")
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set DataTable("p_Text", dtGlobalSheet)
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click

PROGRAM-15

datatable.Importsheet "E:\satya\AMULYA.xls",1,global
OR
datatable.Import "E:\satya\AMULYA.xls"