Monday, October 16, 2017

Files

'----  Files
'Creating the file 
Set fso= CreateObject("Scripting.FileSystemObject")'-----creating the object of file
file_path="F:\myfile.txt"
'fso.CreateTextFile file_path  '--creating the file in f driver


'Writing from a file
set myfiles=fso.OpenTextFile (file_path,2,true)                '----1.read/2.write/8.append?(true--if text file is not found it will create )
myfiles.Write "this is my first line" '--- to write text in a file

myfiles.WriteLine "this is my second line"'---- to write text in a file and cursr go to next line
myfiles.Write "this is my  third line"

Set myfiles=nothing '---destry the object for memrry save

'Reading from a file
set myfile2=fso.OpenTextFile (file_path,1,true)    '----reading the text file "1"
print myfile2.ReadLine
print myfile2.ReadLine

While myfile2.AtEndOfLine<>true
    print myfile2.ReadLine
Wend

Set myfile2=nothing '---destroy the object for memrry save

-----------------------------------------------------
RANDOM numbers

'print randomnumber(5,10000)


'str="sudheersureshsunilsunitha"
str1="abcdefghijklmnopqrstuvwxyz"

's=mid (str,1,2)

'If s="sudheer" Then
'    print "sucess"
'End If


generateRandon 10

Function generateRandon(n)

For i = 1 To n Step 1
    s=s+mid (str1,randomnumber(1,27),7)
Next
print s

End Function

No comments:

Post a Comment

Description Programming

'==Descriptive Programming language 'creating the common browser and page object  Set  myPage= browser( "creationtime:=0...