Custom Search

Thursday, December 6, 2018

How to find repeated character from given dynamic string

str="i am busy at work in my company"
str=Replace(str," ","")
For i=1ToLen(str)-1
 IfLen(str)=0Then
  Exitfor
 EndIf
 k=Mid(str,1,1)
 IfInStr(Right(str,Len(str)-1),k)>0Then
  str2=str2&k
  str=Replace(str,k,"")
  Else
  str=Replace(str,k,"")
 EndIf
Next


MsgBox str2

Friday, December 19, 2014

solution for "the requested operation requires elevation" error while opening QTP through AOM

Open Regedit and go to below path

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]

change the "EnableLUA"value to 0

save and restart the system.

Thursday, May 29, 2014

Getting running applications names from task manager

Set Word = CreateObject("Word.Application")
Set Tasks = Word.Tasks
For Each Task in Tasks
   If Task.Visible Then msgbox Task.Name
Next
Word.Quit

Thursday, January 24, 2013

how to concatenate string with double quotes without using “&” or “+” and double quotes in vbscripting

Dim str(2)
str(1)="Vbscripting"

 str(0)=Chr(34)
  str(2)=Chr(34)

msgbox join(str,"")

How to split the string without using split function

str="i am busy with work"
dim strarray()
Redim preserve strarray(0)

for i = 1 to len(str)

    strchar=mid(str,i,1)
    if strchar<>" " then
        strRes=strRes & strchar
    End if
       
        If strchar=" " Then
                  strsize=ubound(strarray)
                  Redim preserve strarray(strsize+1)
                 strarray(strsize+1)=strRes
                 strRes=""
        End If

        If len(str)=i Then
                strsize=ubound(strarray)
                  Redim preserve strarray(strsize+1)
                 strarray(strsize+1)=strRes
        End If
 
Next

for i=1 to ubound(strarray)
print strarray(i)
next

Wednesday, January 16, 2013

How to swap the numbers in array like even numbers are onside and odd numbers are other side withourt using temp array


strnum=Array(7,2,5,4,9,8,10,23,12,21)

for i=0 to UBound(strnum) -1

            intre= strnum(i) mod 2
            If  intre <> 0 Then
           
                        intre1=strnum(i+1) mod 2           
                        If intre1 = 0 Then
           
                                intnumber=strnum(i)
                                strnum(i)=strnum(i+1)
                                strnum(i+1)=intnumber
                                else
                                For j=i+2 to Ubound(strnum)
                               
                                            If  strnum(j) mod 2 =0 Then
                                                        intnumber=strnum(i)
                                                        strnum(i)=strnum(j)
                                                        strnum(j)=intnumber
                                                        Exit for
                                            End If           
                                Next       
                        End if           
            End if

Next

For i=0 to Ubound(strnum)
print  strnum(i)

Next