Monday, November 3, 2014

How To Convert Lower Case to LOWER Case using VBScript

x=inputbox("Enter String")
For i=1 to len(x) step 1
      y=mid(x,i,1)
      k=lcase(y)
      x=replace(x,y,k)
Next
msgbox(x)

How To Convert Lower Case to Upper Case using VBScript

x=inputbox("Enter String")
For i=1 to len(x) step 1
x=replace(x,mid(x,i,1),ucase(mid(x,i,1)))
Next
msgbox(x)
_____________________________
x=inputbox("Enter String")
For i=1 to len(x) step 1
      y=mid(x,i,1)
      k=ucase(y)
      x=replace(x,y,k)
Next
msgbox(x)

Thursday, June 5, 2014

To find out the index

For i=0 to 100 step 1
With browser ("title:=.*")
  With .page("title:=.*")
    x=.webelement("html tag:=SPAN","index:="&i).getroproperty("innertext")
      print(i&" "&x)
    End With
  End With
Next

Saturday, May 17, 2014

QTP code to find the files name and subfolders of a folder

'to find the files name and subfolders of a folder
      Option explicit
      Dim ohdd, ofo, osfs, n, s, osf, ofs, of, na, ns
'goto hdd
      Set ohdd=createobject("scripting.filesystemobject")
'goto folder
      Set ofo=ohdd.getfolder("F:\QTP")
'goto subfolder
      Set osfs=ofo.subfolders
      Set ofs=ofo.Files
For each of in ofs
na=of.name
ns=of.size
ns=ns/1024
print(na&"   size   =  "&ns&"KB")
Next
print ("------folders-----")
'get all folders names and size individually
For each osf in osfs
   n=osf.name
   s=osf.size
   s=s/1024^2
   print(n&" Size is ="&s&"MB")
Next
'destroy objects
Set osf=nothing
Set osfs=nothing
Set ohdd=nothing

Friday, May 16, 2014

VBSCRIPT to check memory of subfolders

'VBSCRIPT to check memory of subfolders
Option explicit
Dim ohdd, ofo, osfs, n, s, osf
'goto hdd
Set ohdd=createobject("scripting.filesystemobject")
'goto folder
Set ofo=ohdd.getfolder("F:\QTP")
'goto subfolder
Set osfs=ofo.subfolders
'get all folders names and size individually
For each osf in osfs
   n=osf.name
   s=osf.size
   s=s/1024^2
   print(n&" Size is ="&s&"MB")
Next
'destroy objects
Set osf=nothing
Set osfs=nothing
Set ohdd=nothing

VBSCRIPT code to read particular in text file

'VBSCRIPT code to read particular in text file
Option explicit
Dim ohdd, otf, i
'connect to hard disk and open text file
Set ohdd=createobject("scripting.filesystemobject")
Set otf=ohdd.OpenTextFile("C:\Documents and Settings\Administrator\Desktop\11.txt")
'skip line until the required line
For i=1 to 4 step 1
otf.SkipLine
Next
'read particular line
i=otf.ReadLine
print(i)
otf.Close
'destroy objects
Set otf=nothing
Set ohdd=nothing