• No results found

VB Programs

N/A
N/A
Protected

Academic year: 2021

Share "VB Programs"

Copied!
44
0
0

Loading.... (view fulltext now)

Full text

(1)

VBScript General Examples

VBScript General Examples

www.gcreddy.com

www.gcreddy.com

(2)

1) Write a program for finding out

1) Write a program for finding out whether the given year is a leap whether the given year is a leap year oryear or

not

not

Dim xyear Dim xyear

xyear=inputbox ("Enter Year") xyear=inputbox ("Enter Year")

If xyear mod 4=0 Then If xyear mod 4=0 Then

msgbox "This is a Leap year" msgbox "This is a Leap year" Ese Ese msgbox "This is !T" msgbox "This is !T" End If  End If 

!) Write a program for finding out

!) Write a program for finding out whether the given num"er is# Evenwhether the given num"er is# Even

num"er or $dd num"er

num"er or $dd num"er

Dim num Dim num

num=inputbox ("Enter a number") num=inputbox ("Enter a number")

If num mod #=0 Then If num mod #=0 Then

msgbox "This is a E$en !umber" msgbox "This is a E$en !umber" Ese

Ese

msgbox "This is a dd !umber" msgbox "This is a dd !umber" End If 

End If 

%) &ead two num"ers and display the sum

%) &ead two num"ers and display the sum

Dim num%&num#& sum Dim num%&num#& sum

num%=inputbox ("Enter num%") num%=inputbox ("Enter num%") num#=inputbox ("Enter num#") num#=inputbox ("Enter num#")

sum= 'db (num%)  'db (num#) if *e *ant add

sum= 'db (num%)  'db (num#) if *e *ant add t*o strings +on$ersiont*o strings +on$ersion re,uire

re,uire

msgbox ("-um is " .sum) msgbox ("-um is " .sum)

') &ead (##&

') &ead (##& values and *values and *alculate the alculate the Simple +nterestSimple +nterest

Dim p&t& r& si Dim p&t& r& si

p=inputbox ("Enter /rin+ipe") p=inputbox ("Enter /rin+ipe") t=inputbox ("Enter Time") t=inputbox ("Enter Time")

r=inputbox ("Enter ate of Interest") r=inputbox ("Enter ate of Interest")

si= (p1t1r)2%00  p= prin+ipe amount& t=time in years& r= rate of interest si= (p1t1r)2%00  p= prin+ipe amount& t=time in years& r= rate of interest

msgbox ("-impe Interest is " .si) msgbox ("-impe Interest is " .si)

,) &ead -our digit num"

,) &ead -our digit num"er# calculate  disper# calculate  display lay the sum of the num"er orthe sum of the num"er or

display Error message if the num"er is

display Error message if the num"er is not a four digit num"ernot a four digit num"er

Dim num& sum Dim num& sum

num=inputbox ("Enter a 3our digit

num=inputbox ("Enter a 3our digit number")number") If

If Len(num) Len(num) = = 4 Th4 Thenen sum=0

sum=0

sum=sumn

sum=sumnum mod um mod %0%0

num=num2%0 num=num2%0

num= eft (num& ) num= eft (num& )

(3)

1) Write a program for finding out

1) Write a program for finding out whether the given year is a leap whether the given year is a leap year oryear or

not

not

Dim xyear Dim xyear

xyear=inputbox ("Enter Year") xyear=inputbox ("Enter Year")

If xyear mod 4=0 Then If xyear mod 4=0 Then

msgbox "This is a Leap year" msgbox "This is a Leap year" Ese Ese msgbox "This is !T" msgbox "This is !T" End If  End If 

!) Write a program for finding out

!) Write a program for finding out whether the given num"er is# Evenwhether the given num"er is# Even

num"er or $dd num"er

num"er or $dd num"er

Dim num Dim num

num=inputbox ("Enter a number") num=inputbox ("Enter a number")

If num mod #=0 Then If num mod #=0 Then

msgbox "This is a E$en !umber" msgbox "This is a E$en !umber" Ese

Ese

msgbox "This is a dd !umber" msgbox "This is a dd !umber" End If 

End If 

%) &ead two num"ers and display the sum

%) &ead two num"ers and display the sum

Dim num%&num#& sum Dim num%&num#& sum

num%=inputbox ("Enter num%") num%=inputbox ("Enter num%") num#=inputbox ("Enter num#") num#=inputbox ("Enter num#")

sum= 'db (num%)  'db (num#) if *e *ant add

sum= 'db (num%)  'db (num#) if *e *ant add t*o strings +on$ersiont*o strings +on$ersion re,uire

re,uire

msgbox ("-um is " .sum) msgbox ("-um is " .sum)

') &ead (##&

') &ead (##& values and *values and *alculate the alculate the Simple +nterestSimple +nterest

Dim p&t& r& si Dim p&t& r& si

p=inputbox ("Enter /rin+ipe") p=inputbox ("Enter /rin+ipe") t=inputbox ("Enter Time") t=inputbox ("Enter Time")

r=inputbox ("Enter ate of Interest") r=inputbox ("Enter ate of Interest")

si= (p1t1r)2%00  p= prin+ipe amount& t=time in years& r= rate of interest si= (p1t1r)2%00  p= prin+ipe amount& t=time in years& r= rate of interest

msgbox ("-impe Interest is " .si) msgbox ("-impe Interest is " .si)

,) &ead -our digit num"

,) &ead -our digit num"er# calculate  disper# calculate  display lay the sum of the num"er orthe sum of the num"er or

display Error message if the num"er is

display Error message if the num"er is not a four digit num"ernot a four digit num"er

Dim num& sum Dim num& sum

num=inputbox ("Enter a 3our digit

num=inputbox ("Enter a 3our digit number")number") If

If Len(num) Len(num) = = 4 Th4 Thenen sum=0

sum=0

sum=sumn

sum=sumnum mod um mod %0%0

num=num2%0 num=num2%0

num= eft (num& ) num= eft (num& )

(4)

sum=sumn

sum=sumnum um mod mod %0%0

num=num2%0 num=num2%0

num= eft (num& #) num= eft (num& #) sum=sumn

sum=sumnum um mod mod %0%0

num=num2%0 num=num2%0

num= eft (num& %) num= eft (num& %) sum=sumnu

sum=sumnum m mod mod %0%0  msgbox ("-um is " .sum)  msgbox ("-um is " .sum) ese

ese

msgbox "!umber& you entered is not a

msgbox "!umber& you entered is not a 4 digit number"4 digit number" End If 

End If 

/) &ead any -our0digit num"er and display the num"er in

/) &ead any -our0digit num"er and display the num"er in reverse orderreverse order

Dim num&re$ Dim num&re$

num= inputbox("Enter a number") num= inputbox("Enter a number") If en(num)=4 Then

If en(num)=4 Then

re$=re$1%0  num mod %0 re$=re$1%0  num mod %0 num=num2%0

num=num2%0 num= eft(num&) num= eft(num&)

re$=re$1%0  num mod %0 re$=re$1%0  num mod %0 num=num2%0

num=num2%0 num= eft(num&#) num= eft(num&#)

re$=re$1%0  num mod %0 re$=re$1%0  num mod %0 num=num2%0

num=num2%0 num= eft(num&%) num= eft(num&%)

re$=re$1%0  num mod %0 re$=re$1%0  num mod %0

msgbox "e$erse rder of the number is ".re$ msgbox "e$erse rder of the number is ".re$ Ese

Ese

msgbox "!umber& you entered is not a 4

msgbox "!umber& you entered is not a 4 digit number"digit number" End If 

End If 

) &ead ' su"2ects mar3s4 calculate the otal mar3s and grade

) &ead ' su"2ects mar3s4 calculate the otal mar3s and grade

(a) If a$erage mar5s 6reater than or e,ua to 78& grade

(a) If a$erage mar5s 6reater than or e,ua to 78& grade is Distin+tionis Distin+tion b) If a$erage mar5s 6reater than or e,ua to 90

b) If a$erage mar5s 6reater than or e,ua to 90 and ess than 78 & then and ess than 78 & then grade isgrade is 3irst

3irst

+) If a$erage mar5s 6reater than or e,ua to 80

+) If a$erage mar5s 6reater than or e,ua to 80 and ess than 90 & then and ess than 90 & then grade isgrade is -e+ond

-e+ond

d) If a$erage mar5s 6reater than or e,ua to 40

d) If a$erage mar5s 6reater than or e,ua to 40 and ess than 80 & then and ess than 80 & then grade isgrade is Third

Third

e) :inimum mar5s 8 for any sub;e+t& other*ise no grade fai) e) :inimum mar5s 8 for any sub;e+t& other*ise no grade fai)

Dim e&m&p&+& tot Dim e&m&p&+& tot

e=inputbox ("Enter engish :ar5s") e=inputbox ("Enter engish :ar5s") m=inputbox ("Enter maths :ar5s") m=inputbox ("Enter maths :ar5s") p=inputbox ("Enter physi+s :ar5s") p=inputbox ("Enter physi+s :ar5s") +=inputbox ("Enter +hemistry :ar5s") +=inputbox ("Enter +hemistry :ar5s")

(5)

tot= +db(e)  +db(m)  +db(p)  +db(+) tot= +db(e)  +db(m)  +db(p)  +db(+) msgbox tot

msgbox tot

If +db(e) <=8 and +db(m) <=8 and +db(p) <=8 and +db(+) <=8 and tot If +db(e) <=8 and +db(m) <=8 and +db(p) <=8 and +db(+) <=8 and tot <=00 Then

<=00 Then

msgbox "6rade is Distin+tion" msgbox "6rade is Distin+tion"

ese If

ese If +db(e) <=8 an+db(e) <=8 and +db(m) <=8 and +db(m) <=8 and +db(p) <=8 and +d +db(p) <=8 and +db(+) <=8 and totdb(+) <=8 and tot <=#40 and tot00 Then

<=#40 and tot00 Then msgbox "6rade is 3irst" msgbox "6rade is 3irst"

ese If +db(e) <=8 and +db(m) <=8 and +db(p) <=8 and +db(+) <=8 and ese If +db(e) <=8 and +db(m) <=8 and +db(p) <=8 and +db(+) <=8 and tottot <=#00 and tot#40 Then

<=#00 and tot#40 Then

msgbox "6rade is -e+ond" msgbox "6rade is -e+ond"

ese If +db(e) <=8 and +db(m) <=8 and +db(p) <=8 and +db(+) <=8 and ese If +db(e) <=8 and +db(m) <=8 and +db(p) <=8 and +db(+) <=8 and tottot <=%90 and tot#00 Then

<=%90 and tot#00 Then

msgbox "6rade is Third" msgbox "6rade is Third" ese

ese

msgbox "!o 6rade& 3ai" msgbox "!o 6rade& 3ai"

End If  End If  End If  End If  End If  End If  End If  End If  5) 6isplay $dd num"ers up to n 5) 6isplay $dd num"ers up to n Dim num&n Dim num&n

n=Inputbox ("Enter a >aue") n=Inputbox ("Enter a >aue") 3or num= % to n step #

3or num= % to n step # msgbox num

msgbox num !ext

!ext

7) 6isplay Even num"ers up to n

7) 6isplay Even num"ers up to n

Dim num&n Dim num&n

n=Inputbox ("Enter a >aue") n=Inputbox ("Enter a >aue") 3or num= # to n step #

3or num= # to n step # msgbox num

msgbox num !ext

!ext

18) display natural num"ers up to n and write in

18) display natural num"ers up to n and write in a text filea text file

Dim num& n& fso& myfie Dim num& n& fso& myfie n= inputbox ("Enter any

n= inputbox ("Enter any >aue")>aue") num=%

num=%

3or num= % to n step % 3or num= % to n step % -et fso=

-et fso= +reateob;e+t ("s+ripting?fiesystemob;e+t+reateob;e+t ("s+ripting?fiesystemob;e+t")") set myfie=fso?opentextfie ("E@Ag+r?txt"& B& true) set myfie=fso?opentextfie ("E@Ag+r?txt"& B& true) myfie?*riteine num

myfie?*riteine num myfie?+ose

(6)

!ext

11) 6isplay 9atural num"ers in reverse order up to n

Dim num&n

n=Inputbox ("Enter a >aue") 3or num=n to % step C%

msgbox num !ext

1!) 6isplay 9atural num"ers sum up to n :;sing -or...9ext <oop)

Dim num& n& sum

n= inputbox ("Enter a >aue") sum=0

3or num= % to n step % sum= sumnum !ext

msgbox sum

1%) 6isplay 9atural num"ers sum up to n :using While...Wend <oop)

Dim num& n& sum

n= inputbox ("Enter a >aue") hie num =+db (n)

sum= sumnum num=num% end

msgbox sum

1') 6isplay 9atural num"ers sum up to n :;sing 6o...;ntil...<oop)

Dim num& n& sum

n= inputbox ("Enter a >aue") sum=0

num=% Do

sum= sumnum num=num%

Loop nti num =+db (n%) msgbox sum

1,) Write a -unction for 9atural 9um"ers sum up to n

3un+tion !!um'ou (n) Dim num& sum

sum=0

3or num= % to n step % sum= sumnum !ext

msgbox sum End 3un+tion

(7)

1/) Verify weather the entered 18 digit value is a numeric value or not

Dim a&x&y&F&num

num=Inputbox ("Enter a /hone !umber")

d%= eft (num&%) d%0=ight (num&%)

d#=mid (num& #& en (%)) d=mid (num& & en (%)) d4=mid (num& 4& en (%)) d8=mid (num& 8& en (%)) d9=mid (num& 9& en (%)) d7=mid (num& 7& en (%)) dB=mid (num& B& en (%)) dG=mid (num& G& en (%))

If isnumeri+ (d%) = "True" and isnumeri+ (d#) = "True" and isnumeri+ (d) = "True" and isnumeri+ (d4) = "True"and isnumeri+ (d8) = "True"and isnumeri+ (d9) =

"True"and isnumeri+ (d7) = "True"and isnumeri+ (dB) = "True"and isnumeri+ (dG) = "True"and isnumeri+ (d%0) = "True" Then

msgbox "It is a !umeri+ >aue" ese

 :sgbox "It is !T !umeri+"  End If 

1) Verify weather the entered value is a 18 digit value or not and 9umeric value or not :;sing multiple if conditions)

Dim a&x&y&F&num

num=Inputbox ("Enter a /hone !umber")

d%= eft (num&%) d%0=ight (num&%)

d#=mid (num& #& en (%)) d=mid (num& & en (%)) d4=mid (num& 4& en (%)) d8=mid (num& 8& en (%)) d9=mid (num& 9& en (%)) d7=mid (num& 7& en (%)) dB=mid (num& B& en (%)) dG=mid (num& G& en (%))

If en (num) =%0 Then

If isnumeri+ (d%) = "True" and isnumeri+ (d#) = "True" and isnumeri+ (d) = "True" and isnumeri+ (d4) = "True"and isnumeri+ (d8) = "True"and isnumeri+ (d9) =

"True"and isnumeri+ (d7) = "True"and isnumeri+ (dB) = "True"and isnumeri+ (dG) = "True"and isnumeri+ (d%0) = "True" Then

(8)

End If  End If 

If en (num) < %0 Then

 :sgbox "It is !T $aid !umber " End If 

*ontrol -low Examples

:;sing *onditional and <oop Statements) 15) &ead a num"er and verify that num"er &ange weather in "etween 1 to 188 or 181 to 1888

ption expi+it Dim a&x

a=Inputbox ("Enter a Vaule")

a=+db(a)

If a= %00 Then 3or x= % to %00 If a=x Then

msgbox "a is in bet*een % to %00 range" End If 

!ext ese

3or x= %0% to %000 If a=x Then

msgbox "a is in bet*een %0% to %000 range" End If 

!ext End If 

17) &ead 6ata and find that data si=e# +f si=e >?' then display invalid data message# if data si=e @ ' then verify Aa is there or not in that data

Dim x

x=Inputbox ("Enter 4 digit $aue")

x1=Right(x,1)

x#=Left (x&%) x=mid (x&#&Len(%)) x4=mid (x&&Len(%)) y=en(x) If y=4 Then

If x%="a" or x#="a" or x="a" or x4="a" Then msgbox "a is there"

ese

msgbox "a is !ot there" End If 

ese

(9)

End If 

!8) -or Each...9ext Statement

epeats a group of statements for ea+h eement in an array or +oe+tion

Dim a&b&x () a=#0 b=0 x(0)= "Hddition is ". ab x(%)="-ubstra+tion is " . aCb x(#)= ":utipi+ation is " . a1b x()= "Di$ision is " . a2b

3or Ea+h eement In x msgbox eement !ext

!1. Given num"er is primw or not

Option explicit

Dim

 n, i, ounter 

ounter = !

n=

cint

(

inputbox

("enter nuber"))

For

 i = 1

To

 n

If 

 n

mod

 i = !

Then

ounter = ounter # 1

End If 

Next

If 

 ounter = 2

Then

msgbox

"$rienuber"

Else

msgbox

"%ot$rienuber"

(10)

Find the total number of prime numbers for a given Number.

Dim counter,i,j, num,val

num=cint(inputbox("enter value for num"))

for i= 2 to num

for j = 1 to i

if i mod j = 0 Then

 

counter=counter+1

end if 

 

ext

if counter=2 Then

val=val!pace (2)!i

end if 

  #ounter=0

  ext

$%box val

&Program to check if the given string is a Palindrome or not

$'tr=cae(inputbox("*nter the trin%"))

evtr=trrevere($'tr)

if trcomp($'tr,evtr)=0 then

m%box "-t i a .alindrome"

(11)

ele

m%box "-t i not a .alindrome"

end if 

rite a b *ript to +i*pla -atorial o- a nuber u*ing -untion

Answer

. 1

sub fact(pnum)

dim vf

vf=1

for i=2 to pnum

vf=vf*i

next

msgbox vf

end sub

call fact(0)

call fact(3)

'Program to reverse a string without using

strreverse

MyStr = inputbox("Enter the String:") nCnt = Len(MyStr) For i = 1 to nCnt RevStr = Mid(MyStr,i,1)&RevStr ext M!gbox RevStr

Fibonacii number 

Dim

 n

n =

CINT

(

Inputbox

("Enter a range"))

-1=!

(12)

-3=-1#-2

ar= -1/","/-2

Do While

  -30n

ar = ar/","/-3

-1=-2

-2=-3

-3=-1#-2

loop

MsgBox

ar 

.leae find m' code /ith 10 uer and avin% the rder number in m' created xl

'Create excel obj 

Set m'xl=createobject("excelapplication" )

m'xlor3boo3pen "#4er4*ael24De3top45li%ht-D"

m'xl6pplication7iible= True

Set  m'heet=m'xl6ctiveor3boo3or3heet( "8o%in")

For 

 i = 1 To 10

.artner-D = m'heetcell(i,"6")7alue

.a/ord = m'heetcell(i,"9")7alue

'Invoke Flight Application

'temutilun "#4.ro%ram 5ile4:.4nified 5unctional

Tetin%4ample4fli%ht4app4fli%ht;aexe"

'Enter Agent Name and Password 

Dialo%("8o%in")in*dit("6")Set .artner-D

Dialo%("8o%in")in*dit(".")Set .a/ord

Dialo%("8o%in")in9utton("<")#lic3

'Enter Fly reservation rom to get !rderNo

indo/("5li%ht eervation")inbject("Date of 5li%ht")T'pe "10121"

indo/("5li%ht eervation")in#ombo9ox("5l' 5rom")Select 2

indo/("5li%ht eervation")in#ombo9ox("5l' To")Select >

indo/("5li%ht eervation")in9utton("58-?:T")#lic3

indo/("5li%ht eervation")Dialo%("5li%ht Table")in8it("5rom")Select 

indo/("5li%ht eervation")Dialo%("5li%ht Table")in9utton("<")#lic3

indo/("5li%ht eervation")in*dit("ame")Set "6ja'"

(13)

indo/("5li%ht eervation")inadio9utton( "5irt")#lic3

indo/("5li%ht eervation")in*dit("Tic3et")Set 

indo/("5li%ht eervation")in9utton("-nert rder")#lic3

wait

10

rdero = indo/("5li%ht eervation")in*dit("rder

o")?et.ropert'("text")

Msgbox rdero

m'heetcell(i, "#")7alue = rdero

'Close Application

indo/("5li%ht eervation")#loe

Next

m'xl6ctiveor3boo3ave

m'xl6ctiveor3boo3#loe

m'xl6pplication@uit

Set m'heet = nothing

Set m'xl = nothing

6im a 6im c:188) a @ C13!e%e'r,t/hi5C " @ <en:a) -or i @ 1 to " c:i) @ Did:a#i#1) +f isnumeric:c:i)) hen Dsg"ox c:i) End +f  9ext

systemuti?un "iexpore?exe"& "http@22ms+ampaignfa+tory?+om" -et a;ayin5s=des+ription?'reate

a;ayin5s("mi++ass")?>aue = "Lin5"

-et :-L = ro*ser("+reationtime@=0")?/age("tite@=?1")?'hidb;e+ts(a;ayin5s) Tota=:-L?+ount

msgbox Tota

3or i = % To tota step C%

myin5s= :-L(i)?6et/roperty("innertext") /rint myin5s

(14)

!ext

1) Verify <ogin Boundary ('he+5 a the boundary +onditions of the Login diaog box? 'he+5s to see if the +orre+t message appears in the error *indo* (3ight eser$ation :essage)

%) Hppi+ationDir = En$ironment("/rodu+tDir")

#) Hppi+ation/ath = "AsampesAfightAappAfight4a?exe" ) If indo*("3ight eser$ation")?Exist(#) Then

4) indo*("3ight eser$ation")?'ose

8) -ystemti?un Hppi+ationDir . Hppi+ation/ath 9) Eseif !ot Diaog("Login")?Exist(%) Then

7) -ystemti?un Hppi+ationDir . Hppi+ation/ath B) End If 

G) Diaog("Login")?inEdit("Hgent !ame@")?-et Datatabe?>aue ("Hgent!ame"&dt6oba-heet)

%0) Diaog("Login")?inEdit("/ass*ord@")?-et Datatabe?>aue ("/ass*ord"&dt6oba-heet)

%%) Diaog("Login")?inutton("J")?'i+5

%#) If Diaog("Login")?Diaog("3ight eser$ations")?Exist(%) and Datatabe?>aue ("-tatus"&dt6oba-heet)="3ai" Then

%) Diaog("Login")?Diaog("3ight eser$ations")?-tati+("Hgent name must be at")?'he+5 'he+5/oint("Hgent name must be at east 4 +hara+ters ong?") %4) Diaog("Login")?Diaog("3ight eser$ations")?inutton("J")?'i+5 %8) Eseif indo*("3ight eser$ation")?Exist(%0) and Datatabe?>aue ("-tatus"&dt6oba-heet)="/ass" Then

%9) eporter?eportE$ent /H--&"Login@ "&"-u++eeded" %7) Ese

%B) eporter?eportE$ent 3ai&"Login@ "&"'ombination K" . Datatabe?6et'urrento* . " *as not a++ording to Ex+e fie"

%G) End If 

!) Verify *ancel $peration (in Login Diaog box& if user see+ts +an+e button& before enter any data after enter data diaog box shoud be disappeared?)

%) In$o5eappi+ation "'@A/rogram 3iesA:er+ury Intera+ti$eAui+5Test /rofessionaAsampesAfightAappAfight4a?exe"

#) Diaog("Login")?H+ti$ate

) Diaog("Login")?inutton("'an+e")?'i+5 4) If Diaog("Login")?Exist (#) =True Then 8) eporter?eportE$ent %&"sd"&"3ai" 9) Ese

(15)

7) eporter?eportE$ent 0&"sd"&"/ass"

B) In$o5eappi+ation "'@A/rogram 3iesA:er+ury Intera+ti$eAui+5Test /rofessionaAsampesAfightAappAfight4a?exe"

G) End If 

%0) Diaog("Login")?H+ti$ate

%%) Diaog("Login")?inEdit("Hgent !ame@")?-et "asdf" %#) Diaog("Login")?inutton("'an+e")?'i+5

%) If Diaog("Login")?Exist (#) =True Then %4) eporter?eportE$ent %&"sd"&"3ai" %8) Ese

%9) eporter?eportE$ent 0&"sd"&"/ass"

%7) In$o5eappi+ation "'@A/rogram 3iesA:er+ury Intera+ti$eAui+5Test /rofessionaAsampesAfightAappAfight4a?exe"

%B) End If 

%G) Diaog("Login")?H+ti$ate

#0) Diaog("Login")?inEdit("Hgent !ame@")?-et "asdf" #%) Diaog("Login")?inEdit("/ass*ord@")?-et-e+ure "4aGGaf48d+bd809+B48%b#74d#da07bBff88%" ##) Diaog("Login")?inutton("'an+e")?'i+5 #) If Diaog("Login")?Exist (#)=True Then #4) eporter?eportE$ent %&"sd"&"3ai" #8) Ese

#9) eporter?eportE$ent 0&"sd"&"/ass"

#7) In$o5eappi+ation "'@A/rogram 3iesA:er+ury Intera+ti$eAui+5Test /rofessionaAsampesAfightAappAfight4a?exe"

#B) End If 

#G) Diaog("Login")?H+ti$ate

0) Diaog("Login")?inEdit("Hgent !ame@")?-et "asdf" %) Diaog("Login")?inEdit("/ass*ord@")?-et-e+ure "4aGGaf48d+bd809+B48%b#74d#da07bBff88%" #) Diaog("Login")?inutton("J")?'i+5

%) Verify ddition# Su"traction# Dultiplication and 6ivision $perations in *alculator pplication. %) Dim aes&ses&des&mes #) >bindo*(">bindo*")?H+ti$ate ) >bindo*(">bindo*")?>bEdit(">bEdit")?-et "%0" 4) >bindo*(">bindo*")?>bEdit(">bEditM#")?-et "#0" 8) $%=>bindo*(">bindo*")?>bEdit(">bEdit")?6et/roperty ("text") 9) $#=>bindo*(">bindo*")?>bEdit(">bEditM#")?6et/roperty ("text") 7) >bindo*(">bindo*")?>button("HDD")?'i+5 B) aes=>bindo*(">bindo*")?>bEdit(">bEditM")?6et>isibeText

(16)

G) >bindo*(">bindo*")?>button("-")?'i+5 %0) ses=>bindo*(">bindo*")?>bEdit(">bEditM")?6et>isibeText %%) >bindo*(">bindo*")?>button(":L")?'i+5 %#) mes=>bindo*(">bindo*")?>bEdit(">bEditM")?6et>isibeText %) >bindo*(">bindo*")?>button("DI>")?'i+5 %4) des=>bindo*(">bindo*")?>bEdit(">bEditM")?6et>isibeText %8) $%=+db($%) %9) $#=+db($#) %7) aes=+db (aes) %B) ses=+db (ses) %G) mes=+db (mes) #0) des=+db (des) #%) If aes=$%$# Then

##) eporter?eportE$ent 0&"es"&"Hddition /assed" #) ese

#4) eporter?eportE$ent %&"es"&"Hddition 3aied" #8) End If 

#9) If ses=$%C$# Then

#7) eporter?eportE$ent 0&"es"&"-ubtra+tion /assed" #B) ese

#G) eporter?eportE$ent %&"es"&"-ubtra+tion 3aied" 0) End If 

%) If mes=$%1$# Then

#) eporter?eportE$ent 0&"es"&":utipe+ation /assed" ) ese

4) eporter?eportE$ent %&"es"&":utipe+ation 3aied" 8) End If 

9) If des=$%2$# Then

7) eporter?eportE$ent 0&"es"&"Di$ision /assed" B) ese

G) eporter?eportE$ent %&"es"&"Di$ision 3aied" 40) End If 

') Verify state of ;pdate $rder Button# "efore open an $rder and after open an $rder (in 3ight eser$ation before opening an order pdate rder button shoud be disabed after opening an order enabed?)

%) ption expi+it #) Dim bo&ao

) If !ot *indo*("3ight eser$ation")?Exist (#) Then

4) -ystemti?un "'@A/rogram 3iesA:er+ury Intera+ti$eAui+5Test /rofessionaAsampesAfightAappAfight4a?exe"

(17)

9) Diaog("Login")?inEdit("Hgent !ame@")?-et "6+reddy" 7) Diaog("Login")?inEdit("/ass*ord@")?-et-e+ure "4aaBb+eGGB4f%a%8ea%B7a#da8b%B+848abb0%+f" B) Diaog("Login")?inutton("J")?'i+5 G) End If  %0) indo*("3ight eser$ation")?H+ti$ate

%%) bo=indo*("3ight eser$ation")?inutton("pdate rder")?6et/roperty ("Enabed")

%#) indo*("3ight eser$ation")?inutton("utton")?'i+5

%) indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("rder !o?")?-et "!"

%4) indo*("3ight eser$ation")?Diaog("pen rder")?inEdit("Edit")?-et "%" %8) indo*("3ight eser$ation")?Diaog("pen rder")?inutton("J")?'i+5 %9) ao=indo*("3ight eser$ation")?inutton("pdate rder")?6et/roperty ("Enabed")

%7) If bo=3ase Then

%B) eporter?eportE$ent 0&"es"&"pdate rder utton Disabed" %G) ese

#0) eporter?eportE$ent %&"es"&"pdate rder utton Enabed" #%) End If 

##) If ao=True Then

#) eporter?eportE$ent 0&"es"&"pdate rder utton Enabed" #4) ese

#8) eporter?eportE$ent %&"es"&"pdate rder utton Disabed" #9) End If 

,) (rice *onsistency# +n -light &eservation (In 3ight eser$ation& 3irst +ass pri+e=1E+onomy +ass pri+e and usiness +ass pri+e=#1E+onomy +ass pri+e) %) ption expi+it

#) Dim n&f&b&e

) If !ot *indo*("3ight eser$ation")?Exist (#) Then

4) -ystemti?un "'@A/rogram 3iesA:er+ury Intera+ti$eAui+5Test /rofessionaAsampesAfightAappAfight4a?exe"

8) Diaog("Login")?H+ti$ate

9) Diaog("Login")?inEdit("Hgent !ame@")?-et "asdf" 7) Diaog("Login")?inEdit("/ass*ord@")?-et-e+ure "4aaBb7b7+8B#9B0+f+b#4d07%4+Gbbf0dff%eb" B) Diaog("Login")?inutton("J")?'i+5 G) End If  %0) 3or n= % to %0 step % %%) indo*("3ight eser$ation")?H+ti$ate %#) indo*("3ight eser$ation")?inutton("utton")?'i+5

(18)

%) indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("rder !o?")?-et "!"

%4) indo*("3ight eser$ation")?Diaog("pen rder")?inEdit("Edit")?-et n %8) indo*("3ight eser$ation")?Diaog("pen rder")?inutton("J")?'i+5 %9) indo*("3ight eser$ation")?inadioutton("3irst")?-et %7) f=indo*("3ight eser$ation")?inEdit("/ri+e@")?6et>isibeText %B) indo*("3ight eser$ation")?inadioutton("usiness")?-et %G) b=indo*("3ight eser$ation")?inEdit("/ri+e@")?6et>isibeText #0) indo*("3ight eser$ation")?inadioutton("E+onomy")?-et #%) e=indo*("3ight eser$ation")?inEdit("/ri+e@")?6et>isibeText ##) f=+db(mid(f&#&en (fC%))) #) b=+db(mid(b&#&en (bC%))) #4) e=+db(mid(e&#&en (eC%))) #8) If f=1e and b=#1e Then

#9) eporter?eportE$ent 0&"es"&"/ri+y 'onsistan+y is there" #7) ese

#B) eporter?eportE$ent %&"es"&"/ri+y 'onsistan+y is !T there" #G) End If 

0) indo*("3ight eser$ation")?inutton("uttonM#")?'i+5 %) indo*("3ight eser$ation")?Diaog("3ight

eser$ations")?inutton("!o")?'i+5 #) !ext

/) Verify otal# +n -light &eservation (In 3ight eser$ation& Tota = Ti+5ets 1 /ri+e)

%) ption Expi+it #) Dim t&p&tot&n

) 3or n= % to %0 step %

4) If !ot *indo*("3ight eser$ation")?Exist (#) Then

8) -ystemti?un "'@A/rogram 3iesA:er+ury Intera+ti$eAui+5Test

/rofessionaAsampesAfightAappAfight4a?exe"&""&"'@A/rogram 3iesA:er+ury Intera+ti$eAui+5Test /rofessionaAsampesAfightAappA"&"open"

9) Diaog("Login")?H+ti$ate

7) Diaog("Login")?inEdit("Hgent !ame@")?-et "6+reddy" B) Diaog("Login")?inEdit("/ass*ord@")?-et-e+ure "4aaBG#d9#+8#Gf%+##GB%78ad7B+8Bf4daBe4" G) Diaog("Login")?inutton("J")?'i+5 %0) End If  %%) indo*("3ight eser$ation")?H+ti$ate %#) indo*("3ight eser$ation")?inutton("utton")?'i+5

%) indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("rder !o?")?-et "!"

(19)

%4) indo*("3ight eser$ation")?Diaog("pen rder")?inEdit("Edit")?-et n %8) indo*("3ight eser$ation")?Diaog("pen rder")?inutton("J")?'i+5 %9) t=indo*("3ight eser$ation")?inEdit("Ti+5ets@")?6et>isibeText %7) p=indo*("3ight eser$ation")?inEdit("/ri+e@")?6et>isibeText %B) tot=indo*("3ight eser$ation")?inEdit("Tota@")?6et>isibeText %G) t=+db (t) #0) p='db(mid(p&#&en (pC%))) #%) tot='db(mid(tot&#&en (totC%))) ##) If tot=t1p Then

#) eporter?eportE$ent 0&"es"&"'a+uation /assed" #4) ese

#8) eporter?eportE$ent %&"es"&"'a+uation 3aied" #9) End If 

#7) !ext

) Verify -light -rom  -light o *om"o Boxes (In 3ight reser$ation& see+t an item from 3y 3rom@ +ombo box and $erify *eather that item a$aiabe or not in 3y To@ +ombo box& i5e this see+t a items one by one in 3y 3rom and $erify *eather see+ted items a$aiabe or not in 3y To?)

%) ption expi+it

#) Dim ,tp&fightMapp&f&t&i&;&x&y

) If !ot indo*("text@=3ight eser$ation")?Exist (7)= True Then 4) T/=En$ironment("/rodu+tDir")

8) 3ightMapp="AsampesAfightAappAfight4a?exe" 9) -ystemti?un T/ . 3ightMapp

7) Diaog("text@=Login")?H+ti$ate

B) Diaog("text@=Login")?inEdit("atta+hed text@=Hgent !ame@")?-et "asdf" G) Diaog("text@=Login")?inEdit("atta+hed text@=/ass*ord@")?-et-e+ure "4aa8eddaf9B0e7a78Gbee%+84%GGda84a8b98"

%0) Diaog("text@=Login")?inutton("text@=J")?'i+5 %%) End If 

%#) indo*("text@=3ight eser$ation")?H+ti$ate

%) indo*("text@=3ight eser$ation")?inutton("*indo* id@=9")?'i+5

%4) indo*("text@=3ight eser$ation")?H+ti$eN("a+xMname@=:as5Edox"&"*indo* id@=0")?Type "0G0G%0"

%8) f=indo*("text@=3ight eser$ation")?in'omboox("atta+hed text@=3y 3rom@")?6etItems'ount

%9) 3or i= 0 to fC% step %

%7) indo*("text@=3ight eser$ation")?in'omboox("atta+hed text@=3y 3rom@")?-ee+t (i)

%B) x=indo*("text@=3ight eser$ation")?in'omboox("atta+hed text@=3y 3rom@")?6et/roperty ("text")

(20)

%G) t=indo*("text@=3ight eser$ation")?in'omboox("atta+hed text@=3y To@"&"x@=#44"&"y@=%47")?6etItems'ount

#0) 3or ;= 0 to tC% step %

#%) indo*("text@=3ight eser$ation")?in'omboox("atta+hed text@=3y To@"&"x@=#44"&"y@=%47")?-ee+t (;)

##) y=indo*("text@=3ight eser$ation")?in'omboox("atta+hed text@=3y To@"&"x@=#44"&"y@=%47")?6et/roperty ("text")

#) If x < y Then

#4) eporter?eportE$ent 0&"es"&"Test /assed" #8) Ese

#9) eporter?eportE$ent %&"es"&"Test 3aied" #7) End If 

#B) !ext #G) !ext

5) Verify $rder 9o Entry in -light &eservation. (In pen rder diaog box& rder !o ob;e+t a++epts numeri+ $aues ony?)

%) If !ot *indo*("3ight eser$ation")?Exist (#) Then

#) -ystemti?un "'@A/rogram 3iesA:er+ury Intera+ti$eAui+5Test /rofessionaAsampesAfightAappAfight4a?exe"

) Diaog("Login")?H+ti$ate

4) Diaog("Login")?inEdit("Hgent !ame@")?-et "asdf" 8) Diaog("Login")?inEdit("/ass*ord@")?-et-e+ure "4aaG++aebb00G9#b47ff7fb0+e8#4+%dBB+b4" 9) Diaog("Login")?inutton("J")?'i+5 7) End If  B) indo*("3ight eser$ation")?H+ti$ate G) indo*("3ight eser$ation")?inutton("utton")?'i+5

%0) indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("rder !o?")?-et "!"

%%) indo*("3ight eser$ation")?Diaog("pen rder")?inEdit("Edit")?-et "a" %#) ord=indo*("3ight eser$ation")?Diaog("pen

rder")?inEdit("Edit")?6et>isibeText %) If ord= "a" Then

%4) eporter?eportE$ent %&"es"&"rder !o b;e+t is ta5ing in$aid data" %8) ese

%9) indo*("3ight eser$ation")?Diaog("pen rder")?inEdit("Edit")?-et "%" %7) indo*("3ight eser$ation")?Diaog("pen rder")?inutton("J")?'i+5 %B) End If 

7) Get est 6ata from a -lat file and use in 6ata 6riven esting :through Scripting)

(21)

%) Dim fso&myfie

#) -et fso=+reateob;e+t("s+ripting?fiesystemob;e+t") ) -et myfie= fso?opentextfie ("3@Ag+r?txt"&%)

4) myfie?s5ipine

8) hie myfie?atendofine < True 9) x=myfie?readine

7) s=spit (x& "&")

B) -ystemti?un "'@A/rogram 3iesA:er+ury Intera+ti$eAui+5Test /rofessionaAsampesAfightAappAfight4a?exe" G) Diaog("Login")?H+ti$ate %0) Diaog("Login")?inEdit("Hgent !ame@")?-et s(0) %%) Diaog("Login")?inEdit("/ass*ord@")?-et-e+ure s(%) %#) Diaog("Login")?inutton("J")?'i+5 %) indo*("3ight eser$ation")?'ose %4) end

18) *ount# how many Buttons and Edit "oxes availa"le in -light &eservation main window.

%) If !ot *indo*("3ight eser$ation")?Exist (#) Then

#) -ystemti?un "'@A/rogram 3iesA:er+ury Intera+ti$eAui+5Test /rofessionaAsampesAfightAappAfight4a?exe"

) Diaog("Login")?H+ti$ate

4) Diaog("Login")?inEdit("Hgent !ame@")?-et "6+reddy" 8) Diaog("Login")?inEdit("/ass*ord@")?-et "mer+ury" 9) Diaog("Login")?inutton("J")?'i+5

7) End If 

B) -et oDes+ = Des+ription?'reate()

G) oDes+("mi++ass")?>aue = "inutton"

%0) -et uttons = indo*("text@=3ight eser$ation")?'hidb;e+ts (oDes+) %%) !umMuttons = uttons?'ount()

%#) -et oDes+%=Des+ription?'reate() %) oDes+%("mi++ass")?>aue="inEdit"

%4) -et Editboxes=indo*("text@=3ight eser$ation")?'hidb;e+ts (oDes+%) %8) !umMEditboxes= editboxes?+ount ()

%9) sum= !umMuttons!umMEditboxes

%7) eporter?eportE$ent #& "es"&"Tota uttons@ ". !umMuttons ."Tota Edit boxes@ ". !umMEditboxes

11) Verify search options in $pen $rder 6ialog "ox

(22)

Hfter see+ting rder !o option& other options shoud be disabed&

Hfter see+ting 'ustomer !ame& 3ight date option enabed and rder !o disabed Hfter see+ting 3ight date option& 'ustomer !ame enabed and rder !o disabed)

%) If !ot *indo*("3ight eser$ation")?Exist (#) Then

#) -ystemti?un "'@A/rogram 3iesA:er+ury Intera+ti$eAui+5Test /rofessionaAsampesAfightAappAfight4a?exe"

) Diaog("Login")?H+ti$ate

4) Diaog("Login")?inEdit("Hgent !ame@")?-et "6+reddy" 8) Diaog("Login")?inEdit("/ass*ord@")?-et-e+ure "4aaGed#8b+0ebde99ed7#9adB7d7eGG%47dBbG+" 9) Diaog("Login")?inutton("J")?'i+5 7) End If  B) indo*("3ight eser$ation")?H+ti$ate G) indo*("3ight eser$ation")?inutton("utton")?'i+5 %0) indo*("3ight eser$ation")?Diaog("pen rder")?H+ti$ate

%%) oe=indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("rder !o?")?6et/roperty ("Enabed")

%#) +e=indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("'ustomer !ame")?6et/roperty ("Enabed")

%) fe=indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("3ight Date")?6et/roperty("Enabed")

%4) o+=indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("rder !o?")?6et/roperty ("'he+5ed")

%8) ++=indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("'ustomer !ame")?6et/roperty ("'he+5ed")

%9) f+=indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("3ight Date")?6et/roperty("'he+5ed")

%7) If (oe=true and +e=true and fe=true) and (o+="33" and ++="33" and f+="33") Then

%B) eporter?eportE$ent 0&"es"&"/ass" %G) ese

#0) eporter?eportE$ent %&"es"&"3ai" #%) End If 

##) indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("rder !o?")?-et "!"

#) ono=indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("rder !o?")?6et/roperty ("'he+5ed")

#4) If ono="!" Then

#8) fd=indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("3ight Date")?6et/roperty ("Enabed")

#9) ono=indo*("3ight eser$ation")?Diaog("pen

(23)

#7) fd=fase #B) ono=fase #G) eporter?eportE$ent 0&"es"&"/ass" 0) ese %) eporter?eportE$ent %&"es"&"3ai" #) End If 

) indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("rder !o?")?-et "33"

4) indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("'ustomer !ame")?-et "!"

8) +n=indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("'ustomer !ame")?6et/roperty ("'he+5ed")

9) If +n="!" Then

7) ono=indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("rder !o?")?6et/roperty ("Enabed")

B) fd=indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("3ight Date")?6et/roperty ("Enabed") G) fd=True 40) ono=fase 4%) eporter?eportE$ent 0&"es"&"/ass" 4#) ese 4) eporter?eportE$ent %&"es"&"3ai" 44) End If 

48) indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("'ustomer !ame")?-et "33"

49) indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("3ight Date")?-et "!"

47) fd=indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("3ight Date")?6et/roperty ("'he+5ed")

4B) If fd="!" Then

4G) ono=indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("rder !o?")?6et/roperty ("Enabed")

80) +n=indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("'ustomer !ame")?6et/roperty ("Enabed") 8%) +n=True 8#) ono=fase 8) eporter?eportE$ent 0&"es"&"/ass" 84) ese 88) eporter?eportE$ent %&"es"&"3ai" 89) End If 

1!) +n <ogin 6ialog "ox# Verify Felp message (The message is OThe pass*ord is :E'Y)

(24)

%) If !ot Diaog("Login")?Exist (#) Then

#) -ystemti?un "'@A/rogram 3iesA:er+ury Intera+ti$eAui+5Test /rofessionaAsampesAfightAappAfight4a?exe"

) End If 

4) Diaog("Login")?H+ti$ate

8) Diaog("Login")?inutton("Pep")?'i+5

9) message=Diaog("Login")?Diaog("3ight eser$ations")?-tati+("The pass*ord is :E'Y")?6et/roperty("text")

7) If message="The pass*ord is :E'Y" Then

B) eporter?eportE$ent 0&"es"&"'orre+t message ".message G) ese

%0) eporter?eportE$ent %&"es"&"orng message " %%) End If 

File System Scripts

1) &ead *ontent from a text file and Write in another text file

Dim ob;3so& my3ie%& my3ie#& x

-et ob;3so=+reateob;e+t("-+ripting?3iesystemob;e+t")

-et my3ie%=ob;3so?opentextfie("'@ADo+uments and

-ettingsAg+rADes5topAg+reddy?txt"&%)

-et my3ie#=ob;3so?+reatetextfie("'@ADo+uments and

-ettingsAg+rADes5topAg+r,tp?txt"&%)

Do nti my3ie%?HtEndf-tream=True

x=my3ie%?eadine

my3ie#?riteine x

Loop

my3ie%?'ose

my3ie#?'ose

-et ob;3so=!othing

!) &ead 9um"ers only from a text file and export to another

text file

Dim ob;3so& ob;Text-tream

,

myText& x

set ob;3so=+reateob;e+t("-+ripting?3iesystemob;e+t")

(25)

-ettingsAg+rADes5topAg+reddy?txt"&%)

-et ob;Text-tream#=ob;3so?opentextfie("'@ADo+uments and

-ettingsAg+rADes5topAg+r,tp?txt"&#)

ob;Text-tream#?riteLine "!umbers"

ob;Text-tream#?riteLine "CCCCCCCCC"

Do nti ob;Text-tream?HtEndf-tream

myText=ob;Text-tream?eadLine

x=spit(myText&" ")

3or i=bound(x) to ubound(x)

If isnumeri+(x(i)) =True Then

ob;Text-tream#?riteLine x(i)

End if 

!ext

Loop

ob;Text-tream?'ose

ob;Text-tream#?'ose

-et ob;3so=!othing

%) *ount <ines in a ext -ile

Dim ob;3so& ob;Textstream& Line'ount

-et ob;3so='reateb;e+t("-+ripting?fiesystemob;e+t")

-et ob;Textstream=ob;3so?penText3ie("'@ADo+uments and

-ettingsAg+rADes5topAab+?txt")

Do hie !ot ob;Textstream?HtEndf-tream

Line'ount = Line'ount  %

 

ob;Textstream?eadLine

  Loop

:sgbox Line'ount

ob;Textstream?'ose

-et ob;Textstream=!othing

(26)

-et ob;3so=!othing

! "reate a Folder 

ption *xplicit

Dim obj5, obj5older, trDirector' trDirector' = "D4?credd'"

et obj5 = #reatebject("criptin%5ile'tembject") et obj5older = obj5#reate5older(trDirector')

#! $elete a Folder

et o5 = #reatebject("criptin%5ile'tembject") o5Delete5older("*4?credd'")

%! "op&ing Folders

et o5=createobject("criptin%5ile'temobject") o5#op'5older "*4%cr", "#4jvr", True

'! "hecking weather the folder available or not( if not creating the folder 

ption *xplicit

Dim obj5, obj5older, trDirector' trDirector' = "D4?credd'"

et obj5 = #reatebject("criptin%5ile'tembject") -f obj55older*xit(trDirector') Then

et obj5older = obj5?et5older(trDirector') m%box trDirector' ! " alread' created " ele

et obj5older = obj5#reate5older(trDirector') end if 

)! *eturning a collection of $isk $rives

et o5 = #reatebject("criptin%5ile'tembject") et colDrive = o5Drive

5or *ach oDrive in colDrive

$%9ox "Drive letter " ! oDriveDrive8etter  ext

(27)

+! ,etting available space on a $isk $rive

et o5 = #reatebject("criptin%5ile'tembject") et oDrive = o5?etDrive("#")

$%9ox "6vailable pace " ! oDrive6vailablepace

Flat File Scripts

*omputer -ile System

It is a feature of the perating -ystem& used to 'reate2:odify2$ie*2deete Dri$es& 3oders and 3ies

$S 6istri"ution

perating -ystem and ther tiities

-ileSystem$"2ect

>-+ript has /ro$ided -ileSystem$"2ect to perform fie system operations through s+ripting

Dim ob;3so

'reating an Hutomation b;e+t in 3ie -ystem +ass& that +an be used to perform perations on 'omputer 3ie -ystem

-et ob;3so='reateb;e+t("s+ripting?3ie-ystemb;e+t") 1) *reating a -ile Dim ob;3so -et ob;3so='reateb;e+t("s+ripting?3ie-ystemb;e+t") ob;3so?'reateText3ie ("E@A6+reddy?txt") ob;3so?'reateText3ie ("E@A6+reddy?do+") ob;3so?'reateText3ie ("E@A6+reddy?xs") ob;3so?'reateText3ie ("E@A6+reddy?pdf")

9oteH e +an 'reate other fies aso& but they a+t as Text23at 3ies -et ob;3ie = ob;3-?'reateText3ie("E@A6+reddy?txt")

!) *hec3ing weather the -ile is availa"le or not# if not creating the -ile

strDire+tory="E@A" str3ie="6+reddy?txt"

(28)

-et ob;3- = 'reateb;e+t("-+ripting?3ie-ystemb;e+t") If ob;3-?3ieExists(strDire+tory . str3ie) Then

-et ob;3oder = ob;3-?6et3oder(strDire+tory) Ese

-et ob;3ie = ob;3-?'reateText3ie("E@A6+reddy?txt") End if 

%) &eading 6ata character "y character from a -lat -ile

-et ob;3- = 'reateb;e+t("-+ripting?3ie-ystemb;e+t") -et ob;3ie = ob;3-?penText3ie("E@A6+reddy?txt"& %) Do nti ob;3ie?HtEndf-tream

str'hara+ters = ob;3ie?ead(%) msgbox str'hara+ters

Loop

') &eading 6ata line "y line from a -lat -ile

-et ob;3- = 'reateb;e+t("-+ripting?3ie-ystemb;e+t") -et ob;3ie = ob;3-?penText3ie("E@A6+reddy?txt"& %) Do nti ob;3ie?HtEndf-tream

str'hara+ters = ob;3ie?eadine msgbox str'hara+ters

Loop

,) 6ata 6riven esting "y fetching est data directly from a ext file.

11111111111111111111111111111111111111111111111111

est &eIuirementH Data Dri$en Testing by 3et+hing Test data

dire+ty from a Text fie?

uthorH 6 ' eddy

Date of 'reation@ %C0BC#0%0

(re0reIuisitesH

g+r?txt (Test Data)

est -lowH

'reating an Hutomation b;e+t in 3ie-ystem +ass

pening the Externa Test Data fie using the b;e+t

ead the Data . -pit the Data

(29)

6enerating the Login peration

/ass /arameters

1111111111111111111111111111111111111111111111111

Dim ob;3so& my3ie& myLine& my3ied

-et ob;3so='reateb;e+t("-+ripting?3ie-ystemb;e+t")

-et my3ie=ob;3so?penText3ie("'@ADo+uments and

-ettingsAg+r?6''CGH%#3DDGADes5topA$indod?txt"&%) % for ead&

#Crite . BCHppend

my3ie?-5ipLine

Do nti my3ie?HtEndf-tream

myLine=my3ie?eadLine

my3ied=-pit(myLine&"&")

-ystemti?un "'@A/rogram 3iesAP/Aui+5Test

/rofessionaAsampesAfightAappAfight4a?exe"

Diaog("text@=Login")?H+ti$ate

Diaog("text@=Login")?inEdit("atta+hed text@=Hgent !ame@")?-et

my3ied(0)

Diaog("text@=Login")?inEdit("atta+hed text@=/ass*ord@")?-et

my3ied(%)

*ait #

Diaog("text@=Login")?inutton("text@=J")?'i+5

indo*("text@=3ight eser$ation")?'ose

Loop

my3ie?'ose

-et ob;3so=!othing

/) Writing data to a text file

Dim -tuff& my3-& rite-tuff& date-tamp date-tamp = Date()

-tuff = "I am /reparing this s+ript@ " .date-tamp

-et my3- = 'reateb;e+t("-+ripting?3ie-ystemb;e+t")

-et rite-tuff = my3-?penText3ie("e@A6+reddy?txt"& B& True) rite-tuff?riteLine(-tuff)

rite-tuff?'ose

-ET rite-tuff = !TPI!6 -ET my3- = !TPI!6

) 6elete a text file

(30)

-et txt3iepath = ob;3-?6et3ie("E@Ag+r?txt") txt3iepath?Deete()

5) *hec3ing weather the -ile is availa"le or not# if availa"le delete the -ile

strDire+tory="E@A" str3ie="g+r?txt"

-et ob;3- = 'reateb;e+t("-+ripting?3ie-ystemb;e+t") If ob;3-?3ieExists(strDire+tory . str3ie) Then

-et ob;3ie = ob;3-?6etfie(strDire+tory . str3ie) ob;3ie?deete ()

End if 

7) *omparing two text files

Dim f%& f#

f%="e@A6+reddy%?txt" f#="e@A6+reddy#?txt"

/ubi+ 3un+tion 'ompare3ies (3ie/ath%& 3ie/ath#) Dim 3-& 3ie%& 3ie#

-et 3- = 'reateb;e+t("-+ripting?3ie-ystemb;e+t")

If 3-?6et3ie(3ie/ath%)?-iFe < 3-?6et3ie(3ie/ath#)?-iFe Then 'ompare3ies = True

Exit 3un+tion End If 

-et 3ie% = 3-?6et3ie(3ie/ath%)?penHsText-tream(%& 0) -et 3ie# = 3-?6et3ie(3ie/ath#)?penHsText-tream(%& 0) 'ompare3ies = 3ase

Do hie 3ie%?HtEndf-tream = 3ase -tr% = 3ie%?ead

-tr# = 3ie#?ead

'ompare3ies = -tr'omp(-tr%& -tr#& 0) If 'ompare3ies < 0 Then 'ompare3ies = True Exit Do End If  Loop 3ie%?'ose() 3ie#?'ose() End 3un+tion 'a 'omparefies(f%&f#)

If 'ompare3ies(f%& f#) = 3ase Then :sgox "3ies are identi+a?"

(31)

Ese

:sgox "3ies are different?" End If 

18) *ounting the num"er of times a word appears in a file

s3ie!ame="E@Ag+r?txt" s-tring="g+reddy"

'onst 3MEHDI!6 = %

Dim o3so& oTxt3ie& seadTxt& oegEx& o:at+hes

-et o3so = 'reateb;e+t("-+ripting?3ie-ystemb;e+t")

-et oTxt3ie = o3so?penText3ie(s3ie!ame& 3MEHDI!6) seadTxt = oTxt3ie?eadH

-et oegEx = !e* egExp oegEx?/attern = s-tring

oegEx?Ignore'ase = bIgnore'ase oegEx?6oba = True

-et o:at+hes = oegEx?Exe+ute(seadTxt) :at+hes3ound = o:at+hes?'ount

-et oTxt3ie = !othing @ -et o3so = !othing @ -et oegEx = !othing msgbox :at+hes3ound

11) &ead a *SV -ile ;sing 6ata"ase echniIues

n Error esume !ext

'onst adpen-tati+ =  'onst adLo+5ptimisti+ =  'onst ad'mdText = .P000%

-et ob;'onne+tion = 'reateb;e+t("HDD?'onne+tion") -et ob;e+ord-et = 'reateb;e+t("HDD?e+ordset")

str/athtoText3ie = "'@ADatabasesA"

ob;'onne+tion?pen "/ro$ider=:i+rosoft?Qet?LED?4?0R" . M "Data -our+e=" . str/athtoText3ie . "R" . M

"Extended /roperties=""textRPD=YE-R3:T=Deimited"""

ob;e+ordset?pen "-ELE'T 1 3: /honeList?+s$"& M

ob;'onne+tion& adpen-tati+& adLo+5ptimisti+& ad'mdText

(32)

s+ript?E+ho "!ame@ " . ob;e+ordset?3ieds?Item("!ame") s+ript?E+ho "Department@ " . M

  ob;e+ordset?3ieds?Item("Department")

s+ript?E+ho "Extension@ " . ob;e+ordset?3ieds?Item("Extension") ob;e+ordset?:o$e!ext

Loop

1!) &ead a ext -ile into an rray

'onst 3oreading = %

-et ob;3- = 'reateb;e+t("-+ripting?3ie-ystemb;e+t") -et ob;Text3ie = ob;3-?penText3ie M

("e@Ag+reddy?txt"& 3oreading)

Do nti ob;Text3ie?HtEndf-tream str!extLine = ob;Text3ie?eadine arr-er$i+eList = -pit(str!extLine & "&")

s+ript?E+ho "-er$er name@ " . arr-er$i+eList(0) 3or i = % to bound(arr-er$i+eList)

s+ript?E+ho "-er$i+e@ " . arr-er$i+eList(i)   !ext

Loop

1%) *alculate si=e of a ext file

Dim ob;3so& 3ie%&3ie#

3ie%="'@ADo+uments and -ettingsA% I6PHTHYADes5topAxyF?txt" -et ob;3so='reateb;e+t("

-+ripting?3ie-ystemb;e+t") x= ob;3so?6et3ie(3ie%)?-iFe :sgbox x. " ytes"

1') est &eIuirementH $pen 1 to 18 orders in -light &eservation # *apture *ustomer names and Export into a ext file

Test 3o*@

Login peration

pen rder peration and form the Loop to open % to %0 rders 'apture 'usomer names using 6et/roperty :ethod

'reate 3ie system b;e+t and pen the Text fie using the b;e+t and Export 'usomer names

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC ption Expi+it

Dim rderM!umber& 'ustomerM!ame& ob;3so& my3ie -et ob;3so='reateb;e+t("-+ripting?3ie-ystemb;e+t")

-et my3ie= ob;3so?'reateText3ie ("'@ADo+uments and -ettingsA% I6PHTHYADes5topAab+!e*?txt"&#)

(33)

my3ie?riteLine "'usomer !ames" my3ie?riteLine "CCCCCCCCCCCCCCCCCCCC"

If !ot indo*("3ight eser$ation")?Exist() Then -ystemti?un "'@A/rogram 3iesAP/Aui+5Test

/rofessionaAsampesAfightAappAfight4a?exe"&""&"'@A/rogram 3iesAP/Aui+5Test /rofessionaAsampesAfightAappA"&"open"

Diaog("Login")?H+ti$ate

Diaog("Login")?inEdit("Hgent !ame@")?-et "asdf" Diaog("Login")?inEdit("/ass*ord@")?-et-e+ure "4+4B8G0B70499bBd+080bbd#4eB%9BG0+747++fB" Diaog("Login")?inutton("J")?'i+5

End If 

3or rderM!umber= % to %0 step % indo*("3ight eser$ation")?H+ti$ate

indo*("3ight eser$ation")?inutton("utton")?'i+5

indo*("3ight eser$ation")?Diaog("pen rder")?in'he+5ox("rder !o?")?-et "!"

indo*("3ight eser$ation")?Diaog("pen rder")?inEdit("Edit")?-et rderM!umber

indo*("3ight eser$ation")?Diaog("pen rder")?inutton("J")?'i+5 'ustomerM!ame = indo*("3ight eser$ation")?inEdit("!ame@")?6et/roperty("text") *ait (#) my3ie?riteLine 'ustomerM!ame !ext my3ie?'ose -et ob;3so=!othing %8) 111111111111111111111111111111111111111111111111111111

est &eIuirementH *apturing all Buttons 9ames from the <ogin 6ialog "ox and exporting to a ext file

Huthor@ G * &eddy

Date of 'reation@ %C0BC#0%0

(re0reIuasitesH g+r?txt

est -lowH

'reating an Hutomation b;e+t in 3ie-ystem +ass pening the Externa Test Data fie using the b;e+t

'reating 'oe+tion ob;e+t and 'apturing utton !ames using the b;e+t riting utton !ames to an Externa Text fie

11111111111111111111111111111111111111111111111111111111

Dim ob;3so& my3ie& outton& uttons& Totuttons

-et ob;3so='reateb;e+t("-+ripting?3ie-ystemb;e+t")

-et my3ie=ob;3so?penText3ie("'@ADo+uments and -ettingsAg+r?6''C GH%#3DDGADes5topA$indod?txt"&#) % for ead& #Crite . BCHppend my3ie?riteLine "utton !ames"

(34)

-et outton=Des+ription?'reate

outton("mi++ass")?$aue="inutton"

-ystemti?un "'@A/rogram 3iesAP/Aui+5Test /rofessionaAsampesAfightAappAfight4a?exe" -et uttons=Diaog("text@=Login")?'hidb;e+ts(outton) Totuttons=uttons?'ount 3or i= 0 to TotuttonsC%   myutton=uttons(i)?6eto/roperty("text") my3ie?riteLine myutton !ext my3ie?'ose -et ob;3so=!othing

1/) 6elete a ext file if it is an empty file

Dim ob;3so& 3ie/ath

3ie/ath="'@ADo+uments and -ettingsAg+reddyADes5topAab+?txt" -et ob;3so='reateb;e+t("-+ripting?3ie-ystemb;e+t") 3ie-iFe=ob;3so?6et3ie(3ie/ath)?-iFe :sgbox 3ie-iFe If 3ie-iFe=0 Then ob;3so?Deete3ie(3ie/ath) End If  -et ob;3so=!othing

6BSE *$99E*+$9

et dbcon = createobject("6DD9connection")

 

dbconpen

"D=$aterAmonitroA220B-D=aB.D=Cualit'B6..=@uic3Tet

.rofeionalB-D=BD6T696*=materB86?6?*=uAen%lih"

m%box dbcontate

&et ocmd = createobject("6DD9command")

&

ocmd6ctive#onnection = dbcon

&

ocmd#ommandText = "Cl Cuer'"

&

ocmd*xecute

et r = #reateobject("6DD9ecordet")

rpen "elect E from dboptAmonitor",dbcon

columencount = r5ield#ount

columnname = r5ield(0)ame!vbtab!r5ield(1)ame

Do /hile r*5 FG True

 

r$ove5irt

datavalue = r5ield(0)7alue!vbtab!r5ield(1)7alue

 

r$oveext

(35)

8oop

et r = nothin%

et dbcon = nothin%

ript to inoe the light Re*eration ppliation heing hether a login *reen i* opene+ If Notialog("8ogin")9Exi*t(!) Then

pp:$ath = ";<$rogra ile*<erur Interatie<>ui?e*t $ro-e**ional<*aple*<-light<app<-light4a9exe"

In!o"eApplic#tion pp:$ath En+ I- 

ript to login in to the ppliation ialog("8ogin")9tiate

ialog("8ogin")9@inE+it("gent %ae;")9$et "?e*tu*er" ialog("8ogin")9@inE+it("$a**or+;")9$et "erur" ialog("8ogin")9@inAutton("BC")9li 

ript to in*ert an or+er an+ print the Br+er %uber  @in+o("light Re*eration")9tiate

@in+o("light Re*eration")9@inAutton("%e")9li 

@in+o("light Re*eration")9@inBbDet("ate o- light;")9T%pe "121212" @in+o("light Re*eration")9@inoboAox("l ro;")9$elect "ran-urt" @in+o("light Re*eration")9@inoboAox("l ?o;")9$elect "8o* ngele*" @in+o("light Re*eration")9@inAutton("8IF?")9li 

@in+o("light Re*eration")9ialog("light* ?able")9@inAutton("BC")9li  @in+o("light Re*eration")9@inE+it("%ae;")9$et "?e*t u*er"

@in+o("light Re*eration")9@inAutton("In*ert Br+er")9li  W#it&

Br+:%u = @in+o("light Re*eration")9@inE+it("Br+er %o;")9etRo$ropert( "text") *gbox "?he Br+er %uber i*; "/Br+:%u

ript to Bpen an Exi*ting Br+er 

Fere e ill a**ue that the or+er i* alrea+ in*erte+ @in+o("light Re*eration")9tiate

(36)

@in+o("light Re*eration")9ialog( "Bpen Br+er")9@inheAox("he or+er")9$et "B%"

@in+o("light Re*eration")9ialog("Bpen Br+er")9@inE+it("Br+er %uber")9$et Br+:%u

@in+o("light Re*eration")9ialog("Bpen Br+er")9@inAutton("BC")9li  ript to up+ate an exi*ting or+er 

@in+o("light Re*eration")9tiate

@in+o("light Re*eration")9@inBbDet("ate o- light;")9T%pe "111111" @in+o("light Re*eration")9@inoboAox("l ro;")9$elect "8o* ngele*" @in+o("light Re*eration")9@inoboAox("l ?o;")9$elect "ran-urt" @in+o("light Re*eration")9@inAutton("8IF?")9li 

@in+o("light Re*eration")9ialog("light* ?able")9@inAutton("BC")9li  @in+o("light Re*eration")9@inE+it("%ae;")9$et "?e*t G*er 1"

@in+o("light Re*eration")9@inAutton("Gp+ate Br+er")9li  ript to lo*e the ppliation

@in+o("light Re*eration")9Close

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&

ript to in*ert an or+er -ro external *prea+*heet

$opulate the +ata into the global*heet, +e-ine the +atatable iteration* u*ing *ript an+ exeute the in*ertor+er 

et the +atatable iteration* un+er te*t *etting* to Run one iteration onl

tep1; Iport the +ata into the Runtie +atatable ata?able9Iport("E;<In*ert Br+er19xl*")

tep 2; et the roount an+ *tore it in a ariable alle+ roount roount = ata?able9etRoount()

(37)

For i = 1 to roount

tep 4; et the urrent ro a* the atie ro ata?able9eturrentRo(i)

tep 5; In*ert or+er *ript ith appropriate paraeter* @in+o("light Re*eration")9tiate

@in+o("light Re*eration")9@inAutton("%e")9li 

@in+o("light Re*eration")9@inBbDet("ate o- light;")9T%pe ata?able9'#lue(1,1) @in+o("light Re*eration")9@inoboAox("l ro;")9$elect ata?able9'#lue(2,1) @in+o("light Re*eration")9@inoboAox("l ?o;")9$elect ata?able9'#lue(3,1) @in+o("light Re*eration")9@inAutton("8IF?")9li 

@in+o("light Re*eration")9ialog("light* ?able")9@inAutton("BC")9li  @in+o("light Re*eration")9@inE+it("%ae;")9et ata?able9'#lue(4,1) @in+o("light Re*eration")9@inAutton("In*ert Br+er")9li 

W#it &

Br+er%o = @in+o("light Re*eration")9@inE+it("Br+er %o;")9etRo$ropert( "text") ata?able9'#lue(5,1) = Br+er%o

Next

ata?able9Export("E;<In*ertBr+erRe*ult9xl*")

@hen ou or ith exel or*heet ala* eep in in+ that the -ir*t ro i* *et -or the

 paraeter nae* i9e the -ir*t ro olun* *houl+ hae the ariable nae* hih e all

in the *ript9

I- ou ant the +ata to be iporte+ to the global *heet then the +ata in the exel -ile

*houl+ be *tore+ in the heet 1 o- the -ile9 I- ou ant the +ata to be iporte+ to the

8oal *heet then the +ata in the exel -ile *houl+ be *tore+ in heet 2 o- the -ile9 @e ill

 paraetriHe the ariable* ith the exel appliation an+ +iretl pull in the +ata -ro the

References

Related documents

In particular, I analyze the following: • Chapter 2 - expected utility without consequentialism, buying/selling price gap, preference reversal, Rabin [3] paradox • Chapter 3

Delta Cultura Cabo Verde (DCCV) gathers and generates the data shown in the following graphs in the online M&amp;E software Infocus5. DCCV is able to use this software since

MENTALLY DISORDERED OFFENDER DISCHARGE PLANNING AIDS SERVICE PROVIDERS • FOOD • TRANSPORTATION • COUNSELING • SPIRITUAL • SUPPORT GROUPS COMMUNITY AFFILIATES HOUSING

Worship Services: Sunday 9:45 AM Outdoors or Livestream on Facebook Sunday School 11:15 AM on Facebook Live Worship Attendance January Attendance Livestream Worship 554

Impact of smoking status on the efficacy of inhaled corticosteroids in chronic obstructive pulmonary disease: a systematic review.. To view these files, please visit the

Hildner («Wife-Murder Deflected: How Stage Husbands’ Prudence and Ingenuity Lead to Differing Outcomes», pp. 13-23) se cen- tra en tres comedias de Lope de Vega (El cuerdo en su casa

- Write a program that prompt the user to insert an integer number then the program will find all the prime numbers between 1 and the inserted number. - Write a program that

To find the prime factorization of a whole number means to write it as the product of only prime numbers.. This is can be useful when finding things like the Greatest Common Factor or