Tuesday, April 10, 2018

My Latest Micro Focus UFT's User Defined Function_ AlphaEnv_Suntro for Desktop and Web and Mobile applications

'''''' My Latest Micro Focus UFT's  User Defined Function_ AlphaEnv_Suntro for Desktop and Web and Mobile applications.
REM '########################################################################################################################################################

REM Common Functions For SunEnv_Suntro

REM Version 24.0 Date:05/09/2017 - Updated the Julian function and Date digit confirmation function

REM Version 25.0 Date:05/14/2017 - Updated the TakeSnapshot Function

REM Version 26.0 Date:05/22/2017 - Updated the VerifyHotKeys function.
       
REM Version 26.0 Date:05/22/2017 - Updated the Common selection of Radio, function.

REM Version 27.0 Date:05/23/2017 - Updated the TakeSnapshot(BmpName) Function

REM Version 28.0 Date:05/24/2017 - Updated the Import and Export test Data Function

REM Version 29.0 Date:05/24/2017 - Converted the CdateToJulianCvrter function for all by reference for Julian date.

REM Version 30.0 Date:05/28/2017 - NextDecisionBtnFun is to verify the button and Click

REM Version 31.0 Date:05/31/2017 - VerifyEnabled & VerifyDisabled function to Verify Object Is  Enabled / Disabled

REM Version 32.0 Date:05/31/2017 - Showpopup Script Execution

REM Version 33.0 Date:06/01/2017 - PbDataWindowValidation

REM Version 34.0 Date:06/01/2017 - Updated the SuntroRadioButton function

REM Version 35.0 Date:06/02/2017 - TestDataDate function is to Add Current date "MMDDYYYYY"  to the TestData

REM Version 36.0 Date:06/03/2017 - PbDataWindowValidation WbShtNo introduced.

REM Version 37.0 Date:06/04/2017 - GetReferenceDt function to covert the date to required DDIL format Date

REM Version 38.0 Date:06/08/2017 - PbDataWindowValidation WbShtNoGC and Gen Updated.

REM Version 39.0 Date:06/26/2017 - MacFormater function is to Formats MAC Address from Account Number

REM Version 40.0 Date:07/17/2017 - The anyBrowClose function is used to Close all tabs the existing browser

REM Version 41.0 Date:07/19/2017 - This Next Decision Btn Mwin function is used to click and skip the X No. of <Next Decision > along the window name

REM Version 42.0 Date:10/06/2017 -  The ClearBrowserCookiesFun function is to Clear the Browser Cookies

REM Version 43.0 Date:10/09/2017 -  The ClearBrowserCookiesFun function is to Clear the Browser Cookies
REM                              -  The Browser_Minimize function is to Minimize the window
REM                                 -  The Browser_maximize function updated
REM Version 44.0 Date:10/10/2017 -  MUITNsFun function is to Convert Suntro UI TN eg.(850) 614-5910 to Normal Number
REM                                 -  RepMuiTelNumsFun function is to Replace the special characters in Suntro UI TN to Normal Number
REM Version 45.0 Date:10/12/2017 -  MyBrowserOpt function is to open my opted Browser
REM                                 -  LoginCredentials function is to login to the Browser
REM Version 46.0 Date:10/25/2017 -  ClearBrowserCookiesChrm function is to Clear the Browser Cookies - For Chrome

REM Version 47.0 Date:01/18/2018 -  MyVarUI_Service function & MyVarUI_ServiceCOMPLETE function is to validate the service

REM Version 48.0 Date:01/29/2018 -  ObjExistsLooping function is to wait for the object by looping.

REM Version 49.0 Date:01/29/2018 -  MyClickNextTab function is to Clcik the NEXT button on the Tabs
REM                                 -  MyClickNextTabFun function is to Clcik the NEXT button on the Tabs through Objects
REM Version 50.0 Date:02/20/2018 -  The MyPwdEncryptorFun function is to encrypt the given Texts
REM Version 51.0 Date:03/14/2018 -  The MyVarUI_Service_TransferCom function is to validate the service
REM '########################################################################################################################################################






REM '########################################################################################################################################################

REM '1.The MaximizeMainwindow is the Recovery Scenario used to Maximize the Application Window when the window gets minimized

REM '########################################################################################################################################################

Public Function MaximizeMainwindow()        

                SwfWindow(VbOrMainFunc("SwfWindow","AppWindow")).Maximize

End Function



REM '########################################################################################################################################################

REM '2.SendHotkey Function is used to press hot keys

REM '########################################################################################################################################################

Public Function SendHotKeys(Keytopress)        
                Dim WshShell
                Set WshShell = CreateObject("WScript.Shell")

                WshShell.SendKeys Keytopress

                Set WshShell = nothing

End Function



REM '########################################################################################################################################################

REM '3.CompareValues function is used to compare Expected and Actual values and display report

REM '########################################################################################################################################################

Public Function CompareValues(Stepname,Expected, Actual)   

  If Expected = Actual Then

                ReporterFun 0,Stepname, Expected, Actual

                Else

                ReporterFun 1,Stepname, Expected, Actual

  End If

End Function



REM '########################################################################################################################################################

REM '4.Browser_maximize Function is used to maximize the Browser - Updated 10/9/2017

REM '########################################################################################################################################################
''''''        Set VarObjMUImaxi = Browser("Suntro-Test")
''''''        Call Browser_maximize(VarObjMUImaxi)
''''''       
Public Function Browser_maximize(ByObjMUImaxi)
               
    ''''' Find the handle for the Browser window

    '''''' hwnd = Browser("Browser").GetROProperty("hwnd")
  
    hwnd = ByObjMUImaxi.GetROProperty("hwnd")


    ''''' Check if the Browser is already maximized or not

    If Window("hwnd:=" & hwnd).GetROProperty("maximized") = True Then

      isMaximized = True

    Else

      isMaximized = False

    End If

   

    ''''' Check if the Browser is maximizable or not

    If Window("hwnd:=" & hwnd).GetROProperty("maximizable") = True Then

      isMaximizable = True

    Else

      isMaximizable = False

    End If

   

    ''''' Maximize the browser window if it is not already maximized and is maximizable

    If isMaximized = False and isMaximizable = True Then

      Window("hwnd:=" & hwnd).Maximize

    End If

End Function



REM '########################################################################################################################################################

REM '5.The BrowClose function is used to Close all tabs the existing browser

REM 'Function to close the existing browsers and all tabs

REM '########################################################################################################################################################

Public Function BrowClose()
               
    If Browser("Browser").Exist(5) Then
       
        'Browser("Browser").CloseAllTabs
        Browser("Browser").Close
       
       
    End If
       
End Function



REM '########################################################################################################################################################

REM '6.The StartBrowser_Maximize function is used to maximize the browser window.

REM 'Function is to maximize the browser window.

REM '########################################################################################################################################################


Public Function StartBrowser_Maximize()

   Dim oDesc,Ie

   Set Ie = CreateObject("InternetExplorer.Application")

   Ie.Visible = True

   Ie.Navigate DataTable("SunEnv_WebApp",dtGlobalSheet)   

   Window("hwnd:=" & Ie.HWND).Maximize

End Function



REM '########################################################################################################################################################

REM '7.Reporter function is used to display report

REM '########################################################################################################################################################

Public Function ReporterFun(Status,StepName, ResExp,ResAct)

 objName = ""


 FileExists = "False"

ResDir =  Environment.Value("ResultDir")

Dim sExt : sExt = UCase( "txt" )

Dim oFS : Set oFS = CreateObject( "Scripting.FileSystemObject" )

Dim sDir : sDir = ResDir&"\"

Dim oFile

Counter = 1

FileCount = oFS.GetFolder( sDir ).Files.Count

For Each oFile In oFS.GetFolder( sDir ).Files

  If UCase( oFS.GetExtensionName( oFile.Name ) ) = sExt Then

   '''' WScript.Echo oFile.Path

   FileName = oFile.Name

   If  FileName = "ResultDetailsLog.Txt" Then

    ResFileExists = "True"   

   End If

  

   If ResFileExists = "True" Then

    Exit For

   End If

  End If

 

  If Counter = FileCount and ResFileExists <> "True" Then  

   oFS.CreateTextFile sDir&"\"&"ResultDetailsLog.Txt"

  End If

  Counter = Counter+1

Next



'''''' Get the date and time

dateStamp = now()

If LCase(Status) = "micfail" or Status = 1 Then

  ''''' Write information to Text File

  ResInfo = dateStamp&" - "&" Status - "&UCase(Status)&" - Expected -  "&ResExp&" - Actual - "&ResAct

  Else

  ''''' Write information to Text File

  '''''' ResInfo = dateStamp&" - "&ResExp

End If



Set WriteResInfo = oFS.OpenTextFile(sDir&"\"&"ResultDetailsLog.txt", 8, True)

WriteResInfo.WriteLine(ResInfo)

 WriteResInfo.Close

SET WriteResInfo = NOTHING

SET oFS = NOTHING



'''''' Call the QTP Reporter Event

Reporter.ReportEvent  Status, StepName, "Expected:-"&ResExp&"   Actual:-"&ResAct


  StMsg = StepName

If Status = 1 Then

  StMsg  = Replace(StMsg,"/","")

 StMsg  = Replace(StMsg,":","")

  StMsg = Replace(StMsg,"?","")

  StMsg = Replace(StMsg,"!","")

  TakeSnapshot StMsg

End If



End Function



REM '########################################################################################################################################################

REM '8.'TakeSnapshot function is used to take Screen shot

REM '########################################################################################################################################################

Public Function TakeSnapshot(BmpName)

                CurTime = now()

                CurTime = Replace(CurTime,"/","_")

                CurTime = Replace(CurTime,":","_")

                CurTime = Replace(CurTime,"\","_")

                CurTime = Replace(CurTime," ","_")

                BmpName = strClean(BmpName)

                BmpName = Replace(BmpName,Chr(32),"") 
               
                If UCase(Trim(DataTable("SunEnv_Application", dtGlobalSheet))) = "SunEnv" and UCase(Trim(DataTable("SunEnv_Execute", dtGlobalSheet))) = "Y" Then
               
                Window("regexpwndtitle:=SunNikACS Rep*.*").CaptureBitmap BmpName&"-"&CurTime&".png",True
               
                End If
               
                If UCase(Trim(DataTable("SunEnv_Application", dtGlobalSheet))) = "GROVER" and UCase(Trim(DataTable("SunEnv_Application", dtGlobalSheet))) = "Suntro" and UCase(Trim(DataTable("SunEnv_Execute", dtGlobalSheet))) = "Y" Then
                   
                    '''''' Find the handle for the Browser window

                    hwnd = Browser("Browser").GetROProperty("hwnd")

                      If Window("hwnd:=" & hwnd).GetROProperty("maximized") = True Then
                     
                        Window("hwnd:=" & hwnd).CaptureBitmap BmpName&"-"&CurTime&".png",True
     
                    End If
                End If  
               
End Function

REM '########################################################################################################################################################

REM '9.'Verification function - Used to Verify UI

REM '########################################################################################################################################################

REM 'Actual value look like Verification"G:\Suntro_Automation\Action_Scripts\Common\Suntro_UI_Verification\CreateNewSubUI_UIVerificationData.xls","Create_NewSub_UIVerify","Suntro_VerificationOfUI"

REM 'Including the "action Name+_UIVerificationData.xls" to the path.

REM 'Verification "w_cre_frame,w_create_new_subscription","Create_NewSub_UIVerify"

Public Function Verification(wnd_Pbname,sheetname_source)

                If wnd_Pbname <>"" and lcase(wnd_Pbname)<>"dialog" Then

    Sname = Split(wnd_Pbname,",")

                                                If UBound(Sname) > 0 Then

                                   Arr = ExamineProperties(Sname(0),Sname(1))

                                                Else

                                                Arr = ExamineProperties("",Sname(0))

                                                End If

                ElseIf lcase(wnd_Pbname)="dialog" Then

                                Arr = ExamineProperties(wnd_Pbname,"")

                Else

                   Arr = ExamineProperties("","")

   End If





                Dim actName

                actName=Environment.Value("ActionName")

                Print "Action Name                        : " & actName
               
               
                Set uft_app = CreateObject("QuickTest.Application")

                Print uft_app.Test.Actions.Count

                For bb = 1 To uft_app.Test.Actions.Count

                                print uft_app.Test.Actions.Item(bb).Name

                                If uft_app.Test.Actions.Item(bb).Name = actName Then

                                                ScriptLoc = Split(uft_app.Test.Actions.Item(bb).Location,"\")

                                                Dim ScLocArr()

                                                For d = 0 To UBound(ScriptLoc) - 1

                                                                ReDim Preserve  ScLocArr(d)

                                                                ScLocArr(d) = ScriptLoc(d)

                                                Next

                                                Fpath = Join(ScLocArr,"\")

                                                Print Fpath

                                                Set uft_app = nothing  

                                                Exit For

                                End If

                Next

               

                ActionNme = actName

               

                ''''' This Condition is for Call by UI Verification in Integration Scripts

                If InStr(ActionNme,"[") <> 0 Then

                                AcName = Split(ActionNme,"[")

                                ActionNme = Trim(AcName(0))

                                Print ActionNme

                End If

                 '''''  Including the action Name to the path.

                FileDir=FPath&"\"&ActionNme&"_UIVerificationData"&".xls"

                Print fileDIR



                DataTable.AddSheet("Suntro_VerificationOfUI")

               DataTable.ImportSheet FileDir,sheetname_source,"Suntro_VerificationOfUI"





If (wnd_Pbname <>"" or wnd_Pbname = "") and lcase(wnd_Pbname)<>"dialog" Then

ChkPpt = Split("Pblabel,Pbbutton,Pbobject,Pbedit,Pblist,Pbeditor",",")

ChkPptDtName  = Split("Label_Text,Button_Text,Object_Text,Editbox_Text,Listbox_Text,Editor_Text",",")

ChkPptDtNameEnable=Split("Label_Enabled,Button_Enabled,Object_Enabled,Editbox_Enabled,Listbox_Enabled,Editor_Enabled",",")

Elseif lcase(wnd_Pbname)="dialog" then

ChkPpt = Split("static,winbutton,winobject,winradiobutton,wincheckbox,wincombobox",",")

ChkPptDtName  = Split("Static_Text,WinButton_Text,WinObject_Text,WinRadioButton_Text,WinCheckbox_Text,WinCombobox_Text",",")

ChkPptDtNameEnable=Split("Static_Enabled,WinButton_Enabled,WinObject_Enabled,WinRadioButton_Enabled,WinCheckbox_Enabled,WinCombobox_Enabled",",")

End if



   PCount = DataTable.GetSheet("Suntro_VerificationOfUI").GetParameterCount



     Set dict = CreateObject("Scripting.Dictionary")

     For q = 1 To PCount

                                ColName = DataTable.GetSheet("Suntro_VerificationOfUI").GetParameter(q).Name

                                                Call dict.Add(ColName,ColName)

     Next





For k = 0 To UBound(ChkPpt)

  For l=1 to DataTable.GetSheet("Suntro_VerificationOfUI").GetRowCount

   DataTable.GetSheet("Suntro_VerificationOfUI").SetCurrentRow(l)



       If Not dict.Exists(ChkPptDtName(k)) Then

                                 Exit For

       End If  



   explbl=DataTable(ChkPptDtName(k),"Suntro_VerificationOfUI")

   expenabled=DataTable(ChkPptDtNameEnable(k),"Suntro_VerificationOfUI")



   ExittheFor = "Yes"

   If  ChkPpt(k) = "Pbedit" or ChkPpt(k) = "Pblist" or ChkPpt(k) = "Pbeditor"  Then

    expPbname = DataTable(Replace(ChkPptDtName(k),"_Text","_PbName"),"Suntro_VerificationOfUI")

    If expPbname = empty Then

     ExittheFor = "Yes"

     Else

      ExittheFor = "No"     

    End If

     explbl = expPbname

            End If



   If ExittheFor = "Yes" and  explbl=empty Then

     Exit for

   End If

 

   status="fail"

          

   For m = 0 To UBound(Arr)

    ClName = Split(Arr(m),"^")

    ActClName = Split(ClName(0),":=")

    ActClNametxt = Split(ClName(1),":=")

    ActClNameenabled = Split(ClName(2),":=")

    ActCINamePbname=Split(ClName(3),":=")

   

    If LCase(ActClNametxt(1)) =  LCase(explbl) Then

     Status = "pass"

    

     explbl1=Replace(explbl,"&","")

    

     If  Lcase(ActClName(1))="Pbedit" or Lcase(ActClName(1))="Pblist" or Lcase(ActClName(1))="Pbeditor" Then

      explbl1=ActCINamePbname(1)

     End If

   

      ''''' Compare the values for the text Verification

      CompareValues explbl1&" text Verification ",Trim(LCase(explbl)),Trim(Lcase(ActClNametxt(1)))

   

                                If expenabled <>""  and LCase(ChkPpt(k)) <> "Pbedit" and LCase(ChkPpt(k)) <> "Pblist" and Lcase(ChkPpt(k))<>"Pbeditor" Then

                                                If Lcase(ActClNameenabled(1)) =Lcase(expenabled) Then

                                                                CompareValues explbl1&" enabled Verification ",Lcase(expenabled),Lcase(ActClNameenabled(1))

                                                                Else

                                                                                Status = "fail"

                                                End If

                                End If

                                If LCase(ChkPpt(k)) <> "Pbedit" and LCase(ChkPpt(k)) <> "Pblist" and Status <> "fail" and Lcase(ChkPpt(k))<>"Pbeditor" Then

                                                Exit For

                                End If

                End If



                If  ChkPpt(k) = "Pbedit" or ChkPpt(k) = "Pblist" or ChkPpt(k) = "Pbeditor" Then

                                If LCase(ActCINamePbname(1)) =  LCase(expPbname) Then

                                                Status = "pass"

                                                CompareValues expPbname&" Pbname Verification ",expPbname,ActCINamePbname(1)

                                                If expenabled <>"" Then

                                                                If Lcase(ActClNameenabled(1)) =Lcase(expenabled)  Then

                                                                                CompareValues expPbname&" enabled Verification ",Lcase(expenabled),Lcase(ActClNameenabled(1))

                                                                                Else

                                                                                                Status = "fail"

                                                                End If

                                                End If

                                                If Status = "fail" Then

                                                                Exit For

                                                End If

                                End If

                End If



    If Status <> "pass" and m = UBound(Arr) Then

     Status = "fail"

    End If    

   Next

   

   If  Status="fail" Then

    Reporter.ReportEvent micFail,explbl&" text Verification ","Expected text """&explbl&""" is not found in the application"

   End If



  Next

Next



DataTable.DeleteSheet("Suntro_VerificationOfUI")

Set dict = nothing

End Function



REM '########################################################################################################################################################

REM '10.Function to Verify Properties of different objects to do UI Validation

REM '########################################################################################################################################################

REM 'How to call the function? call the function with Main window with Sub window.

REM 'ExamineProperties "w_cre_frame","w_find_member"

REM 'ExamineProperties "w_cre_frame","w_create_new_subscription"



Public Function ExamineProperties(MainWindow,PbwdwName)



Dim ObjectArray() ''''' = Array(Pbbtn,Pbedt,Pbobj,Pblst,Pblbl,Pbedtr,Pbtlbar)

Dim MultiObjArray()



If MainWindow <> "Dialog" Then

                ''''' Reads the DDIL Welcome window

                ''''' REM Snatching_Rc = Inputbox("Enter the name of the Snatching Window")

                Snatching_Rc = PbwdwName

               

               ''''' Print "Snatch Window : "&Snatching_Rc&"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"



   ppt = Split("Class Name,text,enabled,Pbname",",")



   If MainWindow <> "" Then

    Set MainWdw = Description.Create

    MainWdw("Class Name").value = "PbWindow"

    MainWdw("regexpwndclass").value ="FNWND390"

   End If



   Set PbWdw = Description.Create

   PbWdw("Class Name").value = "PbWindow"

   If PbwdwName <>"" Then

    PbWdw("Pbname").value = PbwdwName

   End If



swObj = Split("PbButton,PbEdit,PbObject,PbList,PbLabel,PbEditor,PbToolbar",",")

MultiObjArrCounter = 0

For q = 0 To UBound(swObj)

  ReDim Preserve ObjectArray(q)


    Set Pballobj = Description.Create

    Pballobj("Class Name").value = swObj(q)

  set ObjectArray(q) = Pballobj

Next



   If PbwdwName = "" Then

    Set MainWdw = Description.Create

    MainWdw("Class Name").value = "Window"

    MainWdw("regexpwndclass").value ="PbWindow"

                Set Obj = Window(MainWdw).ChildObjects(PbWdw)

    PbWdw("index").value = obj.Count

    Set Obj = PbWindow("Class Name:=PbWindow","index:="&obj.Count -1).PbWindow(PbWdw)

  Else

   If MainWindow <> "" Then

    Set Obj = Window(MainWdw).PbWindow(PbWdw)

    ElseIf PbwdwName <> "" Then

     Set Obj = PbWindow(PbWdw)

   End If

   End If

End If



If LCase(MainWindow) = "dialog" Then

   ppt = Split("Class Name,text,enabled,attached text",",")



    Set MainWdw = Description.Create

    MainWdw("Class Name").value = "PbWindow"

    MainWdw("regexpwndclass").value ="FNWND390"



   Set WdwDialog = Description.Create

   WdwDialog("Class Name").value = "Dialog"

               

                Set winObj = Window(MainWdw).ChildObjects(WdwDialog)

                objCount = winObj.Count



                If  objCount <> 0 Then

                                If  winObj(0).Exist Then

                                                WdwDialog("index").value = 0

                                                Set Obj = Dialog(WdwDialog)

                                End If

                End If



                  '''''  If Obj.Exist Then

                                dlgObj = Split("WinButton,WinEdit,WinObject,WinList,WinRadioButton,WinComboBox,WinCheckBox,Static",",")

                                MultiObjArrCounter = 0

                                For q = 0 To UBound(dlgObj)

                                  ReDim Preserve ObjectArray(q)

                                                Set dlgallobj = Description.Create

                                                dlgallobj("Class Name").value = dlgObj(q)

                                  set ObjectArray(q) = dlgallobj

                                  loopCounter = loopCounter + 1

                                                Next

                  ''''' End If

End If





pptval = ""

For i = 0 To UBound(ppt)

  If pptval = "" Then

   pptval = ppt(i)&":="&Obj.GetROProperty(ppt(i))

   Else

                pptval = pptval&"^"&ppt(i)&":="&Obj.GetROProperty(ppt(i))

  End If

Next


 ''''' Print chr(34)&Pptval&chr(34)


 ReDim Preserve MultiObjArray(MultiObjArrCounter)

MultiObjArray(MultiObjArrCounter) = pptval



''''' For g = 0 To Swdw.Count -1

MultiObjArrCounter = MultiObjArrCounter + 1



  For m = 0 To Ubound(ObjectArray)

                    Set Sbtn =Obj.ChildObjects(ObjectArray(m))

                    ''''' Set Sbtn = Swdw(g).ChildObjects(ObjectArray(e))

                    For j = 0 To Sbtn.Count -1

                                     pptval = ""

                                                     For i = 0 To UBound(ppt)

                                                      If pptval = "" Then

                                                       pptval = ppt(i)&":="&Sbtn(j).GetROProperty(ppt(i))

                                                       Else

                                                        pptval = pptval&"^"&ppt(i)&":="&Sbtn(j).GetROProperty(ppt(i))

                                                      End If

                                                     Next

                                    

                                ''''' Print chr(34)&Pptval&chr(34)

                                    

                                      ReDim Preserve MultiObjArray(MultiObjArrCounter)

                                      MultiObjArray(MultiObjArrCounter) = pptval

                                      MultiObjArrCounter = MultiObjArrCounter + 1

                    Next

  Next

''''' Next

ExamineProperties = MultiObjArray

              ''''' Print "Snatch Window : "&Snatching_Rc&"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"

End Function



REM '########################################################################################################################################################

REM '11.Verify HotKey Function is Used to press hot keys - 'Hotkey Verifications

REM '########################################################################################################################################################

Public Function VerifyHotKeys(keytopress)

                Set WshShell = CreateObject("WScript.Shell")

                ''''' MCC updated 5/22/2017
                SwfWindow(VbOrMainFunc("SwfWindow","AppWindow")).Activate

                SwfWindow(VbOrMainFunc("SwfWindow","AppWindow")).Maximize

                WshShell.SendKeys keytopress

                Set WshShell = nothing

End Function



REM '########################################################################################################################################################

REM '12.UpDown function is to move Up/Down

REM '########################################################################################################################################################

Public Function UpDown(idx)

   If idx <> 0 Then

                   VerifyHotKeysTab("{UP}")

                   wait(1)

                                VerifyHotKeysTab("{DOWN}")

                                Else

                                                VerifyHotKeysTab("{DOWN}") 

                                                wait(1)

                                   VerifyHotKeysTab("{UP}")

   End If

End Function



REM '########################################################################################################################################################

REM '13.'Verify Hotkeys Tab Function is used to press hot keys

REM '########################################################################################################################################################

Public Function VerifyHotKeysTab(keytopress)

Set WshShell = CreateObject("WScript.Shell")

WshShell.SendKeys keytopress

Set WshShell = nothing

End Function



REM '########################################################################################################################################################

REM '14.'ClickByText function is to Click object by Text

REM '########################################################################################################################################################

Public Function ClickByText(ByVal Obj,ByVal strText)

                                Dim l, t, r, b

                                Dim hwnd

                                Dim window_x, window_y, x, y

                                Dim Succeeded

                                Dim dr

                                l = -1

                                t= -1

                                r = -1

                                b = -1

                                ''''' Checking for the object is existing or not

                                If Not Obj.Exist Then

                                                                ''''' Reporter.ReportEvent micFail, "Object Does not Exist", "The object does not exist"

                                                                Exit Function

                                End If

                                ''''' Obj.RefreshObject

                                hwnd = Obj.GetROProperty("HWND")

                                window_x = Obj.GetROProperty("x")

                                window_y = Obj.GetROProperty("Y")

                                Succeeded = TextUtil.GetTextLocation( strText,hwnd,l,t,r,b)

                                If Not Succeeded Then

                                                ShowPopup strText&" - Text not found"

                                else

                                x = window_x +(l+r) / 2

                                y = window_y +(t+b) / 2

                                Set dr = CreateObject("Mercury.DeviceReplay")
                               
                                dr.MouseClick x, y, 0 
                                ''''''                                dr.MouseClick x,y,LEFT_MOUSE_BUTTON
                                ''''''                                dr.MouseDblClick x,y,LEFT_MOUSE_BUTTON
                               
                                End If

End Function



REM '########################################################################################################################################################

REM '15.'The function FunSetSelected is used to select the given value in the List box

REM '########################################################################################################################################################

Public Function FunSetSelected(SelecObj,SelectListValue)         

                Set MainObj = SelecObj

                idx = MainObj.Object.ListBox.FindStringExact(SelectListValue)

                If idx <> -1 Then

                                MainObj.Object.Focus

                                MainObj.Type micReturn

                                MainObj.Object.ListBox.ClearSelected

                                MainObj.Object.ListBox.SetSelected " "&idx&" ", True

                                MainObj.Object.Focus

                                MainObj.Type micReturn

                                wait(2)

                                UpDown idx

                                CompareValues "Select Drop Down Value - "&SelectListValue,"True","True"

                                FunSetSelected = "Pass"

                                Set MainObj = Nothing

                                Else

                                                if SelectListValue <>"" Then

                                                                FunSetSelected = "Fail"

                                                                Set MainObj = Nothing

                                                                CompareValues "Select Drop Down Value - "&SelectListValue,"True","False"

                                                End If

                End If

End Function



REM '########################################################################################################################################################

REM '16.'WriteObjPropToExcel function is to write the object properties to the specified excel sheet

REM '########################################################################################################################################################

Public Function WriteObjPropToExcel(MainWindow,PbwdwName,ExcelPath,SheetName)

                REM the Excel Application

                Dim objExcel

                REM the path to the excel file

                ''''' Dim excelPath

                REM how many worksheets are in the current excel file

                Dim worksheetCount

                Dim counter

                REM the worksheet we are currently getting data from

                Dim currentWorkSheet

                REM the number of columns in the current worksheet that have data in them

                Dim usedColumnsCount

                REM the number of rows in the current worksheet that have data in them

               

                Dim usedRowsCount

                Dim row

                Dim column

                REM the topmost row in the current worksheet that has data in it

                Dim top

                REM the leftmost row in the current worksheet that has data in it

                Dim left

                Dim Cells

                REM the current row and column of the current worksheet we are reading

                Dim curCol

                Dim curRow

                REM the value of the current row and column of the current worksheet we are reading

                Dim word



                REM where is the Excel file located?      

                excelPath = ExcelPath



                REM Create an invisible version of Excel

                Set objExcel = CreateObject("Excel.Application")



                REM don't display any messages about documents needing to be converted

                REM from  old Excel file formats

                objExcel.DisplayAlerts = 0



                REM open the excel document as read-only

                REM open (path, confirmconversions, readonly)

                objExcel.Workbooks.open excelPath, false, false



                                Set currentWorkSheet = objExcel.ActiveWorkbook.Worksheets(SheetName)

                                REM how many columns are used in the current worksheet

                                usedColumnsCount = currentWorkSheet.UsedRange.Columns.Count

                                REM how many rows are used in the current worksheet

                                usedRowsCount = currentWorkSheet.UsedRange.Rows.Count

                               

                                Set Cells = currentWorksheet.Cells

                               

                PropArr = VerifyProperties(MainWindow,PbwdwName)

                RC = 1

                For m = 0 To UBound(PropArr)

                                ClName = Split(PropArr(m),"^")

                                ActClName = Split(ClName(0),":=")

                                ActClNametxt = Split(ClName(1),":=")

                                ActClNameenabled = Split(ClName(2),":=")

                                ActCINamePbname=Split(ClName(3),":=")

                               

                                If FstName <> ActClName(1) Then

                                                RC = 1

                                End If

                                ''''' Class Names for which we are going to write the properties PbButton,PbEdit,PbObject,PbList,PbLabel,PbEditor

                                If LCase(ActClName(1)) = "Pblabel" Then

                                                colname1 = 1    ''''' "Label_Text"

                                                colname2 = 2    ''''' "Label_Enabled"

                                                RC = RC + 1

                                                ElseIf LCase(ActClName(1)) = "Pbbutton" Then

                                                                colname1 = 3    ''''' "Button_Text"

                                                                colname2 = 4    ''''' "Button_Enabled"

                                                                RC = RC + 1

                                                                ElseIf LCase(ActClName(1)) = "Pbobject" Then

                                                                                colname1 = 5    ''''' "Object_Text"

                                                                                colname2 = 6    ''''' "Object_Enabled"

                                                                                RC = RC + 1

                                                                                ElseIf LCase(ActClName(1)) = "Pbedit" Then

                                                                                                colname1 = 7    ''''' "Editbox_Text"

                                                                                                colname2 = 9    ''''' "Editbox_Enabled"

                                                                                                RC = RC + 1

                                                                                                ElseIf LCase(ActClName(1)) = "Pblist" Then

                                                                                                                colname1 = 10    ''''' "Listbox_Text"                                  

                                                                                                                colname2 = 12    ''''' "Listbox_Enabled"

                                                                                                                RC = RC + 1

                                                                                                                ElseIf LCase(ActClName(1)) = "PbEditor" Then

                                                                                                                                colname1 = 13    ''''' "Editor_Text"                                    

                                                                                                                                colname2 = 15    ''''' "Editor_Enabled"

                                                                                                                                RC = RC + 1

                                End If

                               

'''''                                If LCase(ActClName(1)) <> "Pbwindow" Then
'''''
'''''                                               If ActClNametxt(1) <> "" and LCase(ActClName(1)) <> "Pbedit"  Then
'''''
'''''                                                                               Cells(RC,colname1).Value            = ActClNametxt(1)
'''''
'''''                                                                               Cells(RC,colname2).Value            = ActClNameenabled(1)
'''''
'''''                                                               ElseIf LCase(ActClName(1)) = "Pbedit" Then
'''''
'''''                                                                                               Cells(RC,colname1).Value            = ActCINamePbname(1)
'''''
'''''                                                                                               Cells(RC,colname2).Value            = ActClNameenabled(1)
'''''
'''''                                                               Else
'''''
'''''                                                                               RC = RC -1
'''''
'''''                                               End If
'''''
'''''                               End If



                                FstName = ActClName(1)

                                ''''' msgbox FstName

                                Print FstName

                Next

                objExcel.ActiveWorkbook.Save

                objExcel.ActiveWorkbook.Close

                objExcel.Workbooks.Close

                objExcel.Quit



                REM We are done with the Excel object, release it from memory

                Set objExcel = Nothing                 

End Function



REM '########################################################################################################################################################

REM '17.CrtFolder is to declare the folder path

REM '########################################################################################################################################################

Public Function CrtFolder(newfolderpath)

                set filesys=CreateObject("Scripting.FileSystemObject")

                Fldrs = Split(newfolderpath,"\")

                For h = 1 To UBound(Fldrs)

                                If h = 1 Then

                                                Fldrpath = Fldrs(h)

                                                Else

                                                                Fldrpath = Fldrpath&"\"&Fldrs(h)

                                End If

                                Fpath = Fldrs(0)&"\"&Fldrpath

                                If Not filesys.FolderExists(Fpath) Then

                                   filesys.CreateFolder(Fpath)

                                End If

                Next

                set filesys=nothing

End Function



REM '########################################################################################################################################################

REM '18.DelAllFilesinFolder function is to Delete AllFiles in the specified Folder

REM '########################################################################################################################################################

Public Function DelAllFilesinFolder(folderpath)

                If Right(folderpath,1) <> "\" Then                          

                                folderpath = folderpath&"\"

                End If



                set filesys=CreateObject("Scripting.FileSystemObject")

                If filesys.FolderExists(folderpath) Then

                                If filesys.GetFolder(folderpath).Files.Count <> 0 Then

                                                Const DeleteReadOnly = True

                                                filesys.DeleteFile(folderpath&"*.*"), DeleteReadOnly                                 

                                End If                                  

                End If

                set filesys=nothing

End Function



REM '########################################################################################################################################################

REM '19.SelectPermission Function is to select permission in Defined Member or find member

REM '########################################################################################################################################################

Public Function SelectPermission(wndname,winobjname,scrollbarobj,txtvalue,permission,profiletype)

                If  permission="None" Then

                x=217

                elseif permission="Read" then

                x=250

                elseif permission="Edit" then

                x=295

                End If

               

                wndname.Activate

                wndname.RefreshObject

                hwnd=winobjname.GetROProperty("hwnd")

                l = -1

               

                t = -1

               

                r = -1

               

                b = -1

               

                If  profiletype="member" Then

                                Arr=Array(11,16)

                elseif profiletype="Findmember" then

                                Arr=Array(12,25,37,46,57,71)

                End If



If LCase(txtvalue) = "findmember" Then

                txtvalue = "  Findmember"

End If

                               

                                a=TextUtil.GetTextLocation(txtvalue,hwnd,l,t,r,b,True)

                                                If a=False Then

                                                                                For i=0 to ubound(Arr)

                                                                                                wndname.Activate

                                                                                                wndname.RefreshObject

                                                                                                scrollbarobj.Set Arr(i)

                                                                                                a=TextUtil.GetTextLocation(txtvalue,hwnd,l,t,r,b,True)

                                If a=true Then

                                                                                                                Exit for

                                                                                                End If

                                                                                Next

                                                end if   

               

                                                   y = (t+b)/2



                winobjname.Click x, y   

End Function



REM '########################################################################################################################################################

REM '20.'ReportValidation function is to compare two excel files (or) Validating Generated Report with Golden Copy of the report

REM '########################################################################################################################################################              

Public Function ReportValidation(GoldenCopy,GeneratedReport)

                                Reporter.ReportEvent micPass,"Validating generated report with Golden copy","Comparing Generated report from "&GeneratedReport&" with golden copy from "&GoldenCopy



                                Set objExcel = CreateObject("Excel.Application")

                                objExcel.Visible = True

                                Set objWorkbook1= objExcel.Workbooks.Open (GoldenCopy)            ''''' Path to Actual golden copy of the report

                                Set objWorkbook2= objExcel.Workbooks.Open(GeneratedReport)         ''''' Path to Expected exported  report

                               

                                Set objWorksheet1= objWorkbook1.Worksheets(1)

                                Set objWorksheet2= objWorkbook2.Worksheets(1)

               

                                Dim Actual

                                Dim Expected

                               

                                For Each cell In objWorksheet1.UsedRange



                                Expected=CStr(objWorksheet1.Range(cell.Address).Value)

                                Actual=CStr(objWorksheet2.Range(cell.Address).Value)

                                                                              

                                If(CStr(Expected) <> empty ) then       '''''    Allow only non empty cells

                                                                                                                                              

                                                                If Lcase(CStr(Expected)) <>Lcase(Cstr(Actual)) Then

                                                                              

                                                                                Reporter.ReportEvent micFail, "Report Data :"&cell.Address&" "&Expected,"Expected Value:- "&""""&Expected&""""&chr(13)&" Actual Value :"&""""&Actual&""""



                                                                Else

                                                                              

                                                                                Reporter.ReportEvent micPass, "Report Data :"+Expected,"Expected Value:- "&""""&Expected&""""&chr(13)&" Actual Value :"&""""&Actual&""""



                                                                End if

               

                                End If

               

                                Next



                objWorkbook2.Close

                objWorkbook1.Close

                objExcel.Quit

                Set objExcel=nothing

End Function



REM '########################################################################################################################################################

REM '21.'ExportReport function is to Export the report.

REM '########################################################################################################################################################

Public Function ExportReport(ReportPath)

                                Set VBwnd1=Description.Create

                                VBwnd1("Class Name").value="VbWindow"

                                VBwnd1("nativeclass").value="ThunderRT6FormDC"

                               

                                Set ActivexObj=Description.Create

                                ActivexObj("Class Name").value="ActiveX"

                                ActivexObj("nativeclass").value="ATL:3FED6850"

                               

                                Set ReportPage=description.Create

                                ReportPage("Class Name").value="WinObject"

                                ReportPage("nativeclass").value="ATL:3FED7310"

                                ReportPage("object class").value="ATL:3FED7310"

                               

                                Set Exportbtn=description.Create

                                Exportbtn("Class Name").value="WinObject"

                                Exportbtn("nativeclass").value="ATL:3FED74D8"

                                Exportbtn("object class").value="ATL:3FED74D8"

                                Exportbtn("window id").value="203"


                                Set Export=Description.Create

                                Export("text").value="Export"

                                Export("nativeclass").value="#32770"



                                Set Format = Description.Create

                                Format("nativeclass").value="ComboBox"

                                Format("attached text").value="&Format:"



                                Set Destination=Description.Create

                                Destination("Class Name").value="WinComboBox"

                                Destination("nativeclass").value="ComboBox"

                                Destination("object class").value="ComboBox"

                                Destination("regexpwndclass").value="ComboBox"

                                Destination("attached text").value="&Destination:"



                                Set SelectExportFile=Description.Create

                                SelectExportFile("text").value="Select Export File"

                                SelectExportFile("nativeclass").value="#32770"



                                Set ExportFileName=Description.Create

                                ExportFileName("Class Name").value="WinEdit"

                                ExportFileName("nativeclass").value="Edit"

                                ExportFileName("object class").value="Edit"

                                ExportFileName("regexpwndclass").value="Edit"



                                Set ExcelFormatOptions=Description.Create

                                ExcelFormatOptions("text").value="Excel Format Options"

                                ExcelFormatOptions("nativeclass").value="#32770"



                                Set Okbtn=Description.Create

                                Okbtn("Class Name").value="WinButton"

                                Okbtn("nativeclass").value="Button"

                                Okbtn("object class").value="Button"

                                Okbtn("regexpwndclass").value="Button"

                                Okbtn("regexpwndtitle").value="OK"



                                Set SetExportFileObj=Description.Create

                                SetExportFileObj("Class Name").value="Dialog"

                                SetExportFileObj("nativeclass").value="#32770"

                                SetExportFileObj("object class").value="#32770"

                                SetExportFileObj("regexpwndclass").value="#32770"

                                SetExportFileObj("text").value="Select Export File"



                                Set Savebtn=Description.Create

                                Savebtn("Class Name").value="WinButton"

                                Savebtn("nativeclass").value="Button"

                                Savebtn("object class").value="Button"

                                Savebtn("regexpwndclass").value="Button"

                                Savebtn("regexpwndtitle").value="&Save"



                                Set OverwriteDlg=Description.Create

                                OverwriteDlg("Class Name").value="Dialog"

                                OverwriteDlg("nativeclass").value="#32770"

                                OverwriteDlg("object class").value="#32770"

                                OverwriteDlg("regexpwndclass").value="#32770"

                                OverwriteDlg("text").value="File already exists"



                                Set OverwriteYesbtn=Description.Create

                                OverwriteYesbtn("Class Name").value="WinButton"

                                OverwriteYesbtn("nativeclass").value="Button"

                                OverwriteYesbtn("object class").value="Button"

                                OverwriteYesbtn("regexpwndclass").value="Button"

                                OverwriteYesbtn("text").value="&Yes"                                                                              

              

                                VbWindow(VBwnd1).Activate
               
                                VbWindow(VBwnd1).ActiveX(ActivexObj).WinObject(Exportbtn).Click 14,8
               
                                VbWindow(VBwnd1).Dialog(Export).WinComboBox(Format).Select 4
               
                                VbWindow(VBwnd1).Dialog(Export).WinComboBox(Destination).Select 1
               
                              
               
                                Do Until VbWindow(VBwnd1).Dialog(Export).WinButton(Okbtn).Exist
               
                                                wait(1)
               
                                Loop
               
               
               
                                VbWindow(VBwnd1).Dialog(Export).WinButton(Okbtn).Click
               
                                VbWindow(VBwnd1).Dialog(ExcelFormatOptions).WinButton(Okbtn).Click
               
                                VbWindow(VBwnd1).Dialog(SetExportFileObj).WinEdit(ExportFileName).Type ReportPath
               
                                VbWindow(VBwnd1).Dialog(SetExportFileObj).WinButton(Savebtn).Click
               
                                If Dialog(OverwriteDlg).Exist Then
               
                                                                                Dialog(OverwriteDlg).WinButton(OverwriteYesbtn).Click
               
                                End If
               
                                VbWindow(VBwnd1).Close

End Function



REM '########################################################################################################################################################

REM '22.SavePrintingReport function is to Print Report

REM '########################################################################################################################################################

Public Function SavePrintingReport(PrintPath)

                    Set Pbwnd=Description.Create

                    Pbwnd("Class Name").Value="PbWindow"

                    Pbwnd("nativeclass").Value="WindowsForms10.Window.8.app.0.33c0d9d"

                    Pbwnd("regexpwndclass").Value="WindowsForms10.Window.8.app.0.33c0d9d"



                   Set SavefileDlg=Description.Create

                    SavefileDlg("Class Name").value="Dialog"

                    SavefileDlg("nativeclass").value="#32770"

                    SavefileDlg("object class").value="#32770"

                    SavefileDlg("regexpwndclass").value="#32770"

                    SavefileDlg("text").value="Save the file as"

                   

                    Set PrintFilename=Description.Create

                    PrintFilename("Class Name").value="WinEdit"

                    PrintFilename("nativeclass").value="Edit"

                    PrintFilename("object class").value="Edit"

                    PrintFilename("regexpwndclass").value="Edit"

                   

                    Set PrintSaveBtn=Description.Create

                    PrintSaveBtn("Class Name").value="WinButton"

                    PrintSaveBtn("nativeclass").value="Button"

                    PrintSaveBtn("object class").value="Button"

                    PrintSaveBtn("regexpwndclass").value="Button"

                    PrintSaveBtn("text").value="&Save"

                                                              

                    Dialog(SavefileDlg).Activate

                    Dialog(SavefileDlg).WinEdit(PrintFilename).Type PrintPath

                    Dialog(SavefileDlg).WinButton(PrintSaveBtn).Click

End Function



REM '########################################################################################################################################################

REM '23.bIsUnicode function is to  Report functionality

REM '########################################################################################################################################################

Public Function bIsUnicode( byVal filename)

                ''''' Check for Unicode BOM in file.

                Dim fso, ts, char1, char2

                set fso = createobject("Scripting.FileSystemObject")

                set ts = fso.opentextfile(filename, 1, False)

                char1 =ts.read(1) 

                char2 =ts.read(1)

                ts.close

                bIsUnicode = asc(char1) = 255 and asc(char2) = 254

End Function



REM '########################################################################################################################################################

REM '24.RemoveDupArrVal function is to remove duplicate items from the array

REM '########################################################################################################################################################

Public Function RemoveDupArrVal(ByRef arr)

   Dim i, dict

   If IsArray(arr) Then

     Set dict = CreateObject("Scripting.Dictionary")

     For i = 0 To UBound(arr)

       If Not dict.Exists(arr(i)) Then

         Call dict.Add(arr(i), arr(i))

       End If

     Next

     RemoveDupArrVal = dict.Items

   End If

End Function



REM '########################################################################################################################################################

REM '25.RemoveDupArrVal function is to remove duplicate items from the array

REM '########################################################################################################################################################

Public Function ArrayComp(ByRef arrA, ByRef arrB)

   Dim i, dict

   If IsArray(arrA) Then

     Set dict = CreateObject("Scripting.Dictionary")

     For i = 0 To UBound(arrB)

         Call dict.Add(arrB(i), arrB(i))

     Next

             For i = 0 To UBound(arrA)

                   If Not dict.Exists(arrA(i)) Then

                    Reporter.ReportEvent  micFail,arrA(i)&" - NOT found ","Value"&arrA(i)&"Not Found"

                   End If

               Next

   End If

End Function



REM '########################################################################################################################################################

REM '25.SlctChkBox function is to Select the check box

REM '########################################################################################################################################################

Public Function SlctChkBox(ChkBox,WindowObj)

                ChkBox = Split(ChkBox,",")

                For i = 0 To UBound(ChkBox)

                                set CheckBoxSelection = PbWindow(VbOrMainFunc("PbWindow",WindowObj)).PbObject(VbOrMainFunc("PbObject","BookStdReport,text:="&Trim(ChkBox(i))))

                                If CheckBoxSelection.Object.Checked <> "True" Then

                                                CheckBoxSelection.Click

                                End If

                Next     

End Function



REM '########################################################################################################################################################

REM '26.UnSlctChkBox function is to unSelect the check box

REM '########################################################################################################################################################

Public Function UnSlctChkBox(ChkBox,WindowObj)

                ChkBox = Split(ChkBox,",")

                For j = 0 To UBound(ChkBox)

                set CheckBoxSelection = PbWindow(VbOrMainFunc("PbWindow",WindowObj)).PbObject(VbOrMainFunc("PbObject","BookStdReport,text:="&Trim(ChkBox(j))))

                    If CheckBoxSelection.Object.Checked <> "False" Then

                        CheckBoxSelection.Click

                       End If

                Next     

End Function



REM '########################################################################################################################################################

REM '27.SelectPreferenceRadiobtn function is to Select the Radio button

REM '########################################################################################################################################################

Public Function SelectPreferenceRadiobtn(radiobtnname)

    PbWindow(VbOrMainFunc("PbWindow","AppWindow")).Activate

    SendHotKeys "%ff"



    Set oRadiobtn=description.Create

    oRadiobtn("Class Name").value="PbObject"

    oRadiobtn("text").value=radiobtnname

    oRadiobtn("nativeclass").value="WindowsForms10.Window.8.app.0.33c0d9d"



    Set PrefRdbtnOpt=PbWindow(VbOrMainFunc("PbWindow","PreferencesForm")).PbObject(oRadiobtn)



    If PrefRdbtnOpt.GetROProperty("enabled")=true and PrefRdbtnOpt.GetROProperty("Checked")=false then

                    PrefRdbtnOpt.Set

    End if

    wait(2)

    PbWindow(VbOrMainFunc("PbWindow","PreferencesForm")).PbButton(VbOrMainFunc("PbButton","OKButton")).Click

End Function



REM '########################################################################################################################################################

REM '28.FileCopy function is to copy the file

REM '########################################################################################################################################################

Public Function FileCopy(sourcefile,destinationfile)

    Const OverwriteExisting = TRUE

    Set objFSO = CreateObject("Scripting.FileSystemObject")

    objFSO.CopyFile sourcefile,destinationfile, OverwriteExisting

End Function



REM '########################################################################################################################################################

REM '29.GetSelectedMemberList function is to Get the List of Members that got selected, The below function will return the rows of the selected list of

REM 'Members Separated by comma

REM '########################################################################################################################################################

Public Function GetSelectedMemberList()

    Set GridRangeInfoList = PbWindow(VbOrMainFunc("PbWindow","AppWindow")).PbWindow(VbOrMainFunc("PbWindow","WorkingArea")).PbObject(VbOrMainFunc("PbObject","GroupViewGrid")).Object.Selections.GetSelectedRows(true,false)

    cnt = GridRangeInfoList.Count

   

    SelectedValues = ""

   

    For i = 0 to cnt -1

                    topval = GridRangeInfoList.item(i).top

                    botval = GridRangeInfoList.item(i).bottom

                    If topval <> botval  Then

                                    For m = topval To botval

                                                    If SelectedValues = "" Then

                                                                    SelectedValues = m

                                                                    Else

                                                                                    SelectedValues = SelectedValues&","&m

                                                    End If

                                    Next

                                    Else

                                                    If SelectedValues = "" Then

                                                                    SelectedValues = topval

                                                                    Else

                                                                                    SelectedValues = SelectedValues&","&topval

                                                    End If

                    End If

    Next

    GetSelectedMemberList = SelectedValues

End Function



REM '########################################################################################################################################################

REM '30.GetLocalActionPath function is to Get the path of the Local Action to access the excel data sheets placed inside the Action Folder

REM '########################################################################################################################################################

Public Function GetLocalActionPath()

    ActionName=Environment("ActionName")       

    Set qtp_app = CreateObject("QuickTest.Application")

    For bb = 1 To qtp_app.Test.Actions.Count

                    If qtp_app.Test.Actions.Item(bb).Name = ActionName Then

                                    ScriptLoc = Split(qtp_app.Test.Actions.Item(bb).Location,"\")

                                    Dim ScLocArr()

                                    For d = 0 To UBound(ScriptLoc) - 1

                                                    ReDim Preserve  ScLocArr(d)

                                                    ScLocArr(d) = ScriptLoc(d)

                                    Next

                                    Fpath = Join(ScLocArr,"\")

                                    Set qtp_app = nothing 

                                    Exit For

                    End If

    Next

    GetLocalActionPath = Fpath

End Function



REM '########################################################################################################################################################

REM '31.ShowPopup function is to show a pop-up message to display some wait time for scenarios that would take time

REM '########################################################################################################################################################

Public Function ShowPopup(popupmsg)

    set popmsg = createobject("wscript.shell")

    popupmg = Split(popupmsg,":=")

    Getime = Split(popupmg(0)," ")

    HBound = UBound(Getime)

    If  HBound > 0Then

                    AcTime = HBound/2

                    Else

                                    AcTime = 1

    End If

    If UBound(popupmg) > 0 Then

                    Sec = popupmg(1)

                    Else

                                    Sec = AcTime

    End If

    popmsg.popup popupmg(0),Sec,"Script Execution ...",64

    set popmsg = nothing

End Function



REM '########################################################################################################################################################

REM '32.strClean function is to clean a string with special characters

REM '########################################################################################################################################################

Function strClean (strtoclean)

    Dim objRegExp, outputStr

    Set objRegExp = New Regexp



    objRegExp.IgnoreCase = True

    objRegExp.Global = True

    objRegExp.Pattern = "((?![a-zA-Z0-9]).)+"

    outputStr = objRegExp.Replace(strtoclean, "")



    objRegExp.Pattern = "\-+"

    outputStr = objRegExp.Replace(outputStr, "_")

    strClean = outputStr

End Function



REM '########################################################################################################################################################

REM '32.TerminateApplication function is to Terminate the application in case it could not be closed by the Close Application script

REM '########################################################################################################################################################

Public Function TerminateApplication()

    Set oShell = CreateObject("WScript.Shell")

    Set oWmg = GetObject("winmgmts:")



    strWndprs = "select * from Win32_Process where name='sbddesktop.exe'"

    Set objQResult = oWmg.Execquery(strWndprs)

    For Each objProcess In objQResult

                    intReturn = objProcess.Terminate(1)

    Next

End Function



REM '########################################################################################################################################################

REM '33.Snatching the properties of the Desire Window

REM '########################################################################################################################################################

REM 'How to call the function?

REM 'SnatchProperties()

Public Function SnatchProperties()

    '''' Reads the DDIL Welcome window

    Rc = Inputbox("Enter the name of the Snatching Window")

    Print "Snatch Window : "&Rc&"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"



    Ppt = Split("Class Name,pbname,nativeclass,text,regexpwndclass",",")

    Set PbWdw = Description.Create

    PbWdw("Class Name").value = "PbWindow"

   

   PbObj = Split("PbButton,PbEdit,PbObject,PbList,PbLabel,PbEditor",",")

   Dim ObjectArray()     ''''' = Array(Pbbtn,Pbedt,Pbobj,Pblst,Pblbl,Pbedtr)



   For q = 0 To UBound(PbObj)

                    ReDim Preserve ObjectArray(q)

   

        Set Pballobj = Description.Create

        Pballobj("Class Name").value = PbObj(q)

                    set ObjectArray(q) = Pballobj

   Next



   Pptval = ""

   For i = 0 To UBound(Ppt)

                    If Pptval = "" Then

                                    Pptval = Ppt(i)&":="&PbWindow(PbWdw).GetROProperty(Ppt(i))

                    Else

                    Pptval = Pptval&","&Ppt(i)&":="&PbWindow(PbWdw).GetROProperty(Ppt(i))

                    End If

   Next

   Print chr(34)&Pptval&chr(34)



   For m = 0 To Ubound(ObjectArray)

    Set Sbtn = PbWindow(PbWdw).ChildObjects(ObjectArray(e))

                    For j = 0 To Sbtn.Count -1

    Pptval = ""

                    For i = 0 To UBound(Ppt)

                                    If Pptval = "" Then

                                                    Pptval = Ppt(i)&":="&Sbtn(j).GetROProperty(Ppt(i))

                                    Else

                                                    Pptval = Pptval&","&Ppt(i)&":="&Sbtn(j).GetROProperty(Ppt(i))

                                    End If

                    Next

                    print chr(34)&Pptval&chr(34)

                    Next

   Next

    Print Rc&"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"

End Function



REM '########################################################################################################################################################

REM '34.ImportSheetSourceToDestinationSheet function is to ImportSheet Source sheet to Destination Sheet.

REM '########################################################################################################################################################

REM 'ImportSheetSourceToDestinationSheet "G:\Suntro_Automation\Action_Scripts\Common\Suntro_UI_Validation\w_create_new_subscription_UIValidationData.xls","Create_NewSub_UIVal","Suntro_ValidationOfUI"

Public function ImportSheetSourceToDestinationSheet(FileName, SheetSource, SheetDest)

                DataTable.AddSheet SheetDest

                DataTable.ImportSheet FileName,SheetSource,SheetDest

                Wait 10

End Function



REM '########################################################################################################################################################

REM '35.ModuleIIImportSheetSourceToDestinationSheet function is to ImportSheet Source sheet to Destination Sheet." Taking the Action of the script and adding _UIValidationData.xls (This is golden copy excel file.

REM '########################################################################################################################################################

REM 'ModuleIIImportSheetSourceToDestinationSheet "G:\Suntro_Automation\Action_Scripts\Common\Suntro_UI_Validation\w_create_new_subscription_UIValidationData.xls","Create_NewSub_UIVal","Suntro_ValidationOfUI"

Public function ModuleIIImportSheetSourceToDestinationSheet(FileName, SheetSource, SheetDest)
   
    ''''' Sample 1
    '''''
    ''''' FileDir=FPath&"\"&ActionNme&".xls"
    '''''
    ''''' Print fileDIR
    '''''
    ''''' DataTable.AddSheet("Validation")
    '''''
    ''''' DataTable.ImportSheet FileDir,sheetname_source,"Validation"
    '''''
    ''''' =======
    '''''
    ''''' Sample 2

    DataTable.AddSheet("Suntro_ValidationOfUI")

    ''''' DataTable.ImportSheet(FileName,SheetSource, SheetDest)

    FileDir1="G:\Suntro_Automation\Action_Scripts\Common\Suntro_UI_Validation\w_create_new_subscription_UIValidationData.xls"

    sheetname_source ="Create_NewSub_UIVal"

    DataTable.ImportSheet FileDir1,sheetname_source,"Suntro_ValidationOfUI"

    Wait 20

End Function



REM '########################################################################################################################################################

REM '36.ExtractRowsAndInsertDT function is to Extract all rows and insert into datatable to the particular sheet, Script for Adding two values from datatable         

REM '########################################################################################################################################################

REM 'ExtractRowsAndInsertDT "G:\Suntro_Automation\UAs_manickam\HP UFT\UIDatatable1.xls","SumandInsert","SumandInsert1"



Public Function ExtractRowsAndInsertDT(FileDir2,SheetSource1,SheetDest1)             ''''' FileDirX is the complete path with the FileName.xls

            DataTable.AddSheet(SheetDest1)

            DataTable.ImportSheet  FileDir2,SheetSource1,SheetDest1

             Datatable.GetSheet(3)                                         ''''' You can use sheet no.(1,2,3... OR SheetDest1) OR [Sheet id 1 for global, 2 for Action 1 and so on]

 wait 5

            GetRow1 = DataTable.GetSheet(SheetDest1).GetRowCount

For i = 1 to GetRow1

    Datatable.SetCurrentRow(i)

    in1 = Datatable.Value(1,SheetDest1)         ''''' Parameter ID = 1 mean for NoOfPolicy, and Parameter id =2 for PolicyAmountIn$ and so on.  Sheet ie =1 for Global

    in2 = Datatable.Value(2,SheetDest1)

    in3 = Datatable.Value(3,SheetDest1) 

    in4 = Datatable.Value(4,SheetDest1)

    in5 = Datatable.Value(5,SheetDest1)

    in6 = cint(in1)*cint(in2)

    Print in6

    ''''' For Yearly payment

    If cint(in3) <> "" and cint(in3) = 0 and cint(in4) <>"" and cint(in4) = 0 Then

           Datatable.Value(6,SheetDest1)=cint(in6)*cint(in5)

    End If

    ''''' For Half Yearly payments

    If cint(in3) <> "" and cint(in3) = 0 and cint(in5) <>"" and cint(in5) = 0 Then

            Datatable.Value(6,SheetDest1)=cint(in6)*cint(in4)

    End If

     ''''' For Qtly payments

    If cint(in4) <> "" and cint(in4) = 0 and cint(in5) <>"" and cint(in5) = 0 Then

            Datatable.Value(6,SheetDest1)=cint(in6)*cint(in3)

    End If

    ''''' Datatable.Value(6,SheetDest1)=cint(in6)*cint(in3)*cint(in4)*cint(in5)   '*in4*in5   '  ' Value from datatable is String, so we convert into Integer using cint function

    Next

               

    Datatable.Export("G:\Suntro_Automation\UAs_manickam\HP UFT\UIDatatable2.xls")

 End Function


REM '########################################################################################################################################################

REM '37.OpenExistingSheetandUpdate function is to open the existing file& Sheet and updating it.

REM '########################################################################################################################################################

'OpenExistingSheetandUpdate "G:\Suntro_Automation\Action_Scripts\Common\Suntro_UI_Verification\UI_Verification_UIVerificationData.xls","Create_NewSub_UIVerify"



Public function OpenExistingSheetandUpdate(ExcelPath1,SheetName1)



   Dim objExcel, FilePath

   FilePath = ExcelPath1

   Set objExcel=CreateObject("Excel.Application")

   objExcel.Visible=True

   Set myFile= objExcel.Workbooks.Open (FilePath)

   Set MycurrentWorkSheet=myFile.Worksheets(SheetName1)



                    usedColumnsCount = MycurrentWorkSheet.UsedRange.Columns.Count

                    Print usedColumnsCount

                    REM how many rows are used in the current worksheet

                    usedRowsCount = MycurrentWorkSheet.UsedRange.Rows.Count

                    Print usedRowsCount

                    Set Cells = MycurrentWorkSheet.Cells



    For Iterator = 2 To 10 Step 2

        MycurrentWorkSheet.cells(Iterator,1).value = "UFT : - "&Iterator           

    Next

   

    For Iterator1 = 3 To 10 Step 2

        MycurrentWorkSheet.cells(Iterator1,1).value = "Suntro_September2017 : - "&Iterator1

    Next

    objExcel.ActiveWorkbook.Save

    objExcel.Quit

   Set objExcel=Nothing

               

End Function



REM '########################################################################################################################################################

REM '38.WriteObjPropToExcel1 function is to  to open the existing file& Sheet and Print the Used columns and row count.

REM '########################################################################################################################################################

''''' REM WriteObjPropToExcel1 "w_cre_frame","w_create_new_subscription","G:\Suntro_Automation\Action_Scripts\Common\Suntro_UI_Verification\UI_Verification_UIVerificationData.xls","Create_NewSub_UIVerify"

                                                                                                                                                                                                                     

Public Function WriteObjPropToExcel1(MainWindow,PbwdwName,ExcelPath1,SheetName1)

              

   Dim objExcel, FilePath

   FilePath = ExcelPath1

   Set objExcel=CreateObject("Excel.Application")

   objExcel.Visible=True

   Set myFile= objExcel.Workbooks.Open (FilePath)

   Set MycurrentWorkSheet=myFile.Worksheets(SheetName1)



                    usedColumnsCount = MycurrentWorkSheet.UsedRange.Columns.Count

                    Print usedColumnsCount

                    REM how many rows are used in the current worksheet

                    usedRowsCount = MycurrentWorkSheet.UsedRange.Rows.Count

                    Print usedRowsCount

                    Set Cells = MycurrentWorkSheet.Cells

                               

End function



REM '########################################################################################################################################################

REM '39.FetchWinObjectProperties function is to Fetch the Object Properties of Sub windows for UI Verification

REM '########################################################################################################################################################

REM 'How to call the function? call the function with Main window with Sub window.

REM 'FetchWinObjectProperties "w_cre_frame","w_create_new_subscription" ''''' - Sample1

REM 'FetchWinObjectProperties "w_cre_frame","w_find_member"                                      ' - Sample2



Public Function FetchWinObjectProperties(MainWindow,PbwdwName)

Dim ObjectArray() ' = Array(Pbbtn,Pbedt,Pbobj,Pblst,Pblbl,Pbedtr,Pbtlbar,WinObj,PbtabStr)

Dim MultiObjArray()



If MainWindow <> "Dialog" Then

                ''''' Reads the DDIL Welcome window

                REM SnatchWinName = Inputbox("Enter the name of the Snatching Window")



                SnatchWinName = PbwdwName

               

                Print "Snatch Window Name : "&SnatchWinName&"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"



    ppt = Split("Class Name,text,enabled,Pbname",",")



   If MainWindow <> "" Then

                    Set MainWdw = Description.Create

                    MainWdw("Class Name").value = "PbWindow"

                    MainWdw("regexpwndclass").value ="FNWND390"

   End If



   Set PbWdw = Description.Create

   PbWdw("Class Name").value = "PbWindow"

   If PbwdwName <>"" Then

                    PbWdw("Pbname").value = PbwdwName

   End If



swObj = Split("PbButton,PbEdit,PbObject,PbList,PbLabel,PbEditor,PbToolbar,WinObject,PbTabStrip",",")

MultiObjArrCounter = 0

For q = 0 To UBound(swObj)

  ReDim Preserve ObjectArray(q)


    Set Pballobj = Description.Create

    Pballobj("Class Name").value = swObj(q)

  set ObjectArray(q) = Pballobj

Next



   If PbwdwName = "" Then

    Set MainWdw = Description.Create

    MainWdw("Class Name").value = "PbWindow"

    MainWdw("regexpwndclass").value ="FNWND390"

                Set Obj = Window(MainWdw).ChildObjects(PbWdw)

    PbWdw("index").value = obj.Count

    Set Obj = PbWindow("Class Name:=PbWindow","index:="&obj.Count -1).PbWindow(PbWdw)

  Else

   If MainWindow <> "" Then

    Set Obj = Window(MainWdw).PbWindow(PbWdw)

    ElseIf PbwdwName <> "" Then

     Set Obj = PbWindow(PbWdw)

   End If

   End If

End If



If LCase(MainWindow) = "dialog" Then

   ppt = Split("Class Name,text,enabled,attached text",",")



    Set MainWdw = Description.Create

    MainWdw("Class Name").value = "PbWindow"

    MainWdw("regexpwndclass").value ="FNWND390"



   Set WdwDialog = Description.Create

   WdwDialog("Class Name").value = "Dialog"

               

                Set winObj = Window(MainWdw).ChildObjects(WdwDialog)

                objCount = winObj.Count



                If  objCount <> 0 Then

                                If  winObj(0).Exist Then

                                                WdwDialog("index").value = 0

                                                Set Obj = Dialog(WdwDialog)

                                End If

                End If



                                ''''' If Obj.Exist Then

                                                                dlgObj = Split("WinButton,WinEdit,WinObject,WinList,WinRadioButton,WinComboBox,WinCheckBox,Static",",")

                                                                MultiObjArrCounter = 0

                                                                For q = 0 To UBound(dlgObj)

                                                                  ReDim Preserve ObjectArray(q)

                                                                                Set dlgallobj = Description.Create

                                                                                dlgallobj("Class Name").value = dlgObj(q)

                                                                  set ObjectArray(q) = dlgallobj

                                                                  loopCounter = loopCounter + 1

                                                                                Next

                  ''''' End If

End If



pptval = ""

For i = 0 To UBound(ppt)

  If pptval = "" Then

   pptval = ppt(i)&":="&Obj.GetROProperty(ppt(i))

   Else

                pptval = pptval&"^"&ppt(i)&":="&Obj.GetROProperty(ppt(i))

  End If

Next

               

Print chr(34)&Pptval&chr(34)


 ReDim Preserve MultiObjArray(MultiObjArrCounter)

MultiObjArray(MultiObjArrCounter) = pptval

MultiObjArrCounter = MultiObjArrCounter + 1



  For m = 0 To Ubound(ObjectArray)

    Set Sbtn =Obj.ChildObjects(ObjectArray(m))



   For j = 0 To Sbtn.Count -1

     pptval = ""

     For i = 0 To UBound(ppt)

      If pptval = "" Then

       pptval = ppt(i)&":="&Sbtn(j).GetROProperty(ppt(i))

       Else

        pptval = pptval&"^"&ppt(i)&":="&Sbtn(j).GetROProperty(ppt(i))

      End If

     Next

                   Print chr(34)&Pptval&chr(34)

      ReDim Preserve MultiObjArray(MultiObjArrCounter)

      MultiObjArray(MultiObjArrCounter) = pptval

      MultiObjArrCounter = MultiObjArrCounter + 1

    Next

  Next

  VerifyProperties = MultiObjArray

  Print SnatchWinName&"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"

End Function



REM '########################################################################################################################################################

REM '40.'IndependentVerification function is used to do - Independent UI Verification Script

REM '########################################################################################################################################################

REM 'Actual value look like IndependentVerification "G:\Suntro_Automation\Action_Scripts\Common\Suntro_UI_Verification\CreateNewSubUI_UIVerificationData.xls","Create_NewSub_UIVerify","Suntro_VerificationOfUI"

REM 'Including the "action Name+_UIVerificationData.xls" to the path.

REM 'IndependentVerification "w_cre_frame,w_create_new_subscription","Create_NewSub_UIVerify"

Public Function IndependentVerification(wnd_Pbname,sheetname_source)

                If wnd_Pbname <>"" and lcase(wnd_Pbname)<>"dialog" Then

                    Sname = Split(wnd_Pbname,",")

                                                If UBound(Sname) > 0 Then

                                   Arr = ExamineProperties(Sname(0),Sname(1))

                                                Else

                                                Arr = ExamineProperties("",Sname(0))

                                                End If

                ElseIf lcase(wnd_Pbname)="dialog" Then

                                Arr = ExamineProperties(wnd_Pbname,"")

                Else

                   Arr = ExamineProperties("","")

   End If





                Dim actName

                actName=Environment.Value("ActionName")

                Print "Action Name                        : " & actName
                               

                Set uft_app = CreateObject("QuickTest.Application")

                Print uft_app.Test.Actions.Count

                For bb = 1 To uft_app.Test.Actions.Count

                                print uft_app.Test.Actions.Item(bb).Name

                                If uft_app.Test.Actions.Item(bb).Name = actName Then

                                                ScriptLoc = Split(uft_app.Test.Actions.Item(bb).Location,"\")

                                                Dim ScLocArr()

                                                For d = 0 To UBound(ScriptLoc) - 1

                                                                ReDim Preserve  ScLocArr(d)

                                                                ScLocArr(d) = ScriptLoc(d)

                                                Next

                                                Fpath = Join(ScLocArr,"\")

                                                Print Fpath

                                                Set uft_app = nothing  

                                                Exit For

                                End If

                Next

               

                ActionNme = actName



                 ''''' Including the action Name to the path.

                FileDir=FPath&"\"&ActionNme&"_UIVerificationData"&".xls"

                Print fileDIR



                DataTable.AddSheet("Suntro_VerificationOfUI")

               DataTable.ImportSheet FileDir,sheetname_source,"Suntro_VerificationOfUI"





If (wnd_Pbname <>"" or wnd_Pbname = "") and lcase(wnd_Pbname)<>"dialog" Then

ChkPpt = Split("Pblabel,Pbbutton,Pbobject,Pbedit,Pblist,Pbeditor",",")

ChkPptDtName  = Split("Label_Text,Button_Text,Object_Text,Editbox_Text,Listbox_Text,Editor_Text",",")

ChkPptDtNameEnable=Split("Label_Enabled,Button_Enabled,Object_Enabled,Editbox_Enabled,Listbox_Enabled,Editor_Enabled",",")

Elseif lcase(wnd_Pbname)="dialog" then

ChkPpt = Split("static,winbutton,winobject,winradiobutton,wincheckbox,wincombobox",",")

ChkPptDtName  = Split("Static_Text,WinButton_Text,WinObject_Text,WinRadioButton_Text,WinCheckbox_Text,WinCombobox_Text",",")

ChkPptDtNameEnable=Split("Static_Enabled,WinButton_Enabled,WinObject_Enabled,WinRadioButton_Enabled,WinCheckbox_Enabled,WinCombobox_Enabled",",")

End if



   PCount = DataTable.GetSheet("Suntro_VerificationOfUI").GetParameterCount



     Set dict = CreateObject("Scripting.Dictionary")

     For q = 1 To PCount

                                ColName = DataTable.GetSheet("Suntro_VerificationOfUI").GetParameter(q).Name

                                                Call dict.Add(ColName,ColName)

     Next





For k = 0 To UBound(ChkPpt)

  For l=1 to DataTable.GetSheet("Suntro_VerificationOfUI").GetRowCount

   DataTable.GetSheet("Suntro_VerificationOfUI").SetCurrentRow(l)



       If Not dict.Exists(ChkPptDtName(k)) Then

                                 Exit For

       End If  



   explbl=DataTable(ChkPptDtName(k),"Suntro_VerificationOfUI")

   expenabled=DataTable(ChkPptDtNameEnable(k),"Suntro_VerificationOfUI")



   ExittheFor = "Yes"

   If  ChkPpt(k) = "Pbedit" or ChkPpt(k) = "Pblist" or ChkPpt(k) = "Pbeditor"  Then

    expPbname = DataTable(Replace(ChkPptDtName(k),"_Text","_PbName"),"Suntro_VerificationOfUI")

    If expPbname = empty Then

     ExittheFor = "Yes"

     Else

      ExittheFor = "No"     

    End If

     explbl = expPbname

            End If



   If ExittheFor = "Yes" and  explbl=empty Then

     Exit for

   End If

 

   status="fail"

          

   For m = 0 To UBound(Arr)

    ClName = Split(Arr(m),"^")

    ActClName = Split(ClName(0),":=")

    ActClNametxt = Split(ClName(1),":=")

    ActClNameenabled = Split(ClName(2),":=")

    ActCINamePbname=Split(ClName(3),":=")

   

    If LCase(ActClNametxt(1)) =  LCase(explbl) Then

     Status = "pass"

    

     explbl1=Replace(explbl,"&","")

    

     If  Lcase(ActClName(1))="Pbedit" or Lcase(ActClName(1))="Pblist" or Lcase(ActClName(1))="Pbeditor" Then

      explbl1=ActCINamePbname(1)

     End If

   

      ''''' Compare the values for the text Verification

      CompareValues explbl1&" text Verification ",Trim(LCase(explbl)),Trim(Lcase(ActClNametxt(1)))

   

                                If expenabled <>""  and LCase(ChkPpt(k)) <> "Pbedit" and LCase(ChkPpt(k)) <> "Pblist" and Lcase(ChkPpt(k))<>"Pbeditor" Then

                                                If Lcase(ActClNameenabled(1)) =Lcase(expenabled) Then

                                                                CompareValues explbl1&" enabled Verification ",Lcase(expenabled),Lcase(ActClNameenabled(1))

                                                                Else

                                                                                Status = "fail"

                                                End If

                                End If

                                If LCase(ChkPpt(k)) <> "Pbedit" and LCase(ChkPpt(k)) <> "Pblist" and Status <> "fail" and Lcase(ChkPpt(k))<>"Pbeditor" Then

                                                Exit For

                                End If

                End If



                If  ChkPpt(k) = "Pbedit" or ChkPpt(k) = "Pblist" or ChkPpt(k) = "Pbeditor" Then

                                If LCase(ActCINamePbname(1)) =  LCase(expPbname) Then

                                                Status = "pass"

                                                CompareValues expPbname&" Pbname Verification ",expPbname,ActCINamePbname(1)

                                                If expenabled <>"" Then

                                                                If Lcase(ActClNameenabled(1)) =Lcase(expenabled)  Then

                                                                                CompareValues expPbname&" enabled Verification ",Lcase(expenabled),Lcase(ActClNameenabled(1))

                                                                                Else

                                                                                                Status = "fail"

                                                                End If

                                                End If

                                                If Status = "fail" Then

                                                                Exit For

                                                End If

                                End If

                End If



    If Status <> "pass" and m = UBound(Arr) Then

     Status = "fail"

    End If    

   Next

   

   If  Status="fail" Then

    Reporter.ReportEvent micFail,explbl&" text Verification ","Expected text """&explbl&""" is not found in the application"

   End If



  Next

Next



DataTable.DeleteSheet("Suntro_VerificationOfUI")

Set dict = nothing

End Function



REM '########################################################################################################################################################

REM '41.CdateToJulianCvrter & MydayFunc function is to convert the given Gregorian Date to Julian Date Calendar format

REM '########################################################################################################################################################

REM 'How to execute the Function CdateToJulianCvrter NormalDate

REM 'NormalDate = "10/9/2017 10:36:29 AM"  ' - Sample 1 - 282 days - Julian Date Calendar for Year YYYY

REM 'NormalDate = "6/23/2007 10:36:29 AM"  ' - Sample 2 - 174 days

REM 'NormalDate = "12/31/2024 10:36:29 AM" ' - Sample 3 - 366 days  - To check the leap year

REM 'NormalDate = "3/1/2016 10:36:29 AM"   ' - Sample 4 - 61  days  - To check the leap year

REM 'NormalDate = "11/7/2017 10:38:29 AM"  ' - Sample 5 - 311 days  - Converted the function for all by reference for Julian date.



Function CdateToJulianCvrter(ByRef MyDate, ByRef MyYear)

   
   
    ''''' Assigning DateYear to get year number
   
    DateYear = DatePart("yyyy", MyYear)
   
    MyYear = DateYear
   
    Print MyYear
   
   
   
    CvrterDateToJulian = MydayFunc(MyDate - DateSerial(Year(MyDate) - 1, 12, 31))
   
    MyDate = CvrterDateToJulian
   
    Print MyDate
   
   
   
    ''''' Combining the Gregorian year and Julian day to get JulianDate
   
    JulianDate = DateYear & CvrterDateToJulian
   
   
   
    ''''' Display the Gregorian Date to Julian date format
   
    Print "The equivalent Julian date is    : " & JulianDate
   
               

End Function

 

Function MydayFunc(TheDate)



    MydayFunc = Left(TheDate, InStr(TheDate, ".") - 1)

                                

End Function



REM '########################################################################################################################################################

REM '42. GetUniqueNumber function is to ensures the date digits are in mm,dd, yyyy format and grabbing it.

REM '########################################################################################################################################################

REM 'How to execute the Function GetUniqueNumber()

Public Function GetUniqueNumber( )



    ''''' Ensure month has 2 digits

    If len(DatePart("m",Now)) < 2Then

                    mth = "0" & DatePart("m",Now)

    Else

                    mth = DatePart("m",Now)

    End If

   

    ''''' Ensure day has 2 digits

    If len(DatePart("d",Now)) < 2Then

                    dy = "0" & DatePart("d",Now)

    Else

                    dy = DatePart("d",Now)

    End If

   

    yr= DatePart("yyyy",Now)

    Print mth

    Print dy

    Print yr

    GetUniqueNumber = dy & mth & DatePart("yyyy",Now)

                               

End Function



REM '########################################################################################################################################################

REM '43. SuntroRadioButton function is to set the button

REM '########################################################################################################################################################

REM 'How to execute the Function SuntroRadioButton DltToSubRdbtnNm,"True"    ' "False" & "True"

REM ' Sample1

REM 'If UCase(Trim(DataTable("SunEnv_PrimActMin", "MCC_SunEnv_OrderEntry"))) = "YES"

REM '

REM '                                     Set DltToSubRdbtnNm = SwfWindow("SunNikACS").SwfWindow("Interactive Sales Wizard").SwfRadioButton("Yes")

REM '                                     SuntroRadioButton DltToSubRdbtnNm,"True"    ' "False" & "True"

REM '    

REM '     End If   

Public Function SuntroRadioButton(RdbuttName,CusChkOpt)
        
If RdbuttName.GetROProperty("enabled") = "True" and RdbuttName.GetROProperty("checked")="False" Then

    If CusChkOpt = "True" Then

           RdbuttName.Set
   
    Else
          
           RdbuttName.Set

    End if
   
End if
Wait(2)                

End Function

               

REM '########################################################################################################################################################

REM '44. Suntro_ImportTestData function is to import the test data

REM '########################################################################################################################################################

REM 'Suntro_ImportTestData "G:\Suntro_Automation\Action_Scripts\Suntro_CreateNewMemberSubscription\CreateMemberTestdata_Import_InputData.xls","Suntro_CreateNewMember","Suntro_CreateNewMember_OutPutData"

 Public Function Suntro_ImportTestData(FileDir2,SheetSource1,SheetDest1)          ''''' FileDirX is the complete path with the FileName.xls

                DataTable.AddSheet(SheetDest1)

                DataTable.ImportSheet  FileDir2,SheetSource1,SheetDest1

                Datatable.GetSheet(2)                 ''''' You can use sheet no.(1,2,3... OR SheetDest1) OR [Sheet id 1 for global, 2 for Action 1 and so on]

End Function


REM '########################################################################################################################################################

REM '45. Suntro_ExportTestData function is to Export the test data

REM '########################################################################################################################################################

REM ' Suntro_ExportTestData "G:\Suntro_Automation\Action_Scripts\Suntro_CreateNewMemberSubscription\CreateMemberTestdata_Export_OutPutData.xls"

Public Function Suntro_ExportTestData(FileDir3)          ''''' FileDirX is the complete path with the FileName.xls

    Print FileDir3

    Datatable.Export FileDir3

 End Function




REM '########################################################################################################################################################              

REM '46.'PbDataWindowValidation function is to compare two excel files (or) Validating Generated PbDataWindow with Golden Copy of the PbDataWindow

REM '########################################################################################################################################################              

REM 'PbDataWindowValidation "C:\Users\s_manickam\Desktop\PbDtGoldenCopy.xls","C:\Users\s_manickam\Desktop\PbDtGenerated.xls" ,"5","6"

Public Function PbDataWindowValidation(PbdtGoldenCopy,PbdtGenerated,WbShtNoGC,WbShtNoGen)

Reporter.ReportEvent micPass,"Validating Generated PbDataWindow with Golden copy","Comparing Generated PbDataWindow from "&PbdtGenerated&" with golden copy from "&PbdtGoldenCopy



Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

Set objWorkbook1= objExcel.Workbooks.Open(PbdtGoldenCopy)                       ''''' Path to Actual golden copy of the PbDataWindow

Set objWorkbook2= objExcel.Workbooks.Open(PbdtGenerated)                         ''''' Path to Expected exported PbDataWindow

WbShtNoGC = Cint(WbShtNoGC)

WbShtNoGen = Cint(WbShtNoGen)



Set objWorksheet1= objWorkbook1.Worksheets(WbShtNoGC)

Set objWorksheet2= objWorkbook2.Worksheets(WbShtNoGen)



Dim Actual

Dim Expected



For Each cell In objWorksheet1.UsedRange



Expected=CStr(objWorksheet1.Range(cell.Address).Value)

Actual=CStr(objWorksheet2.Range(cell.Address).Value)

                                              

If(CStr(Expected) <> empty ) then   ''''' Allow only non empty cells

                                                                                                              

                                If Lcase(CStr(Expected)) <>Lcase(Cstr(Actual)) Then

                                              

                                                Reporter.ReportEvent micFail, "PbDataWindow Data : "&cell.Address&" "&Expected,"Expected Value :- "&""""&Expected&""""&chr(13)&" Actual Value :- "&""""&Actual&""""



                                Else

                                              

                                                Reporter.ReportEvent micPass, "PbDataWindow Data : "+Expected,"Expected Value :- "&""""&Expected&""""&chr(13)&" Actual Value :- "&""""&Actual&""""



                                End if



End If



Next



objWorkbook2.Close

objWorkbook1.Close

objExcel.Quit

Set objExcel=nothing

End Function



REM '########################################################################################################################################################              

REM '47.'GetReferenceDt function is to covert the date to required DDIL format Date

REM '########################################################################################################################################################              

REM ''How to use it the GetReferenceDt function

REM ''Pass the variable GivenDate to the GetReferenceDt function ByRef

REM ' Dim GivenDate : GivenDate = ClmLnNbr(i,j)                                            ''''' "09-02-2017"    ''''' "09/02/14"

REM ' Call GetReferenceDt(GivenDate)                                                       ''''' The reference of GivenDate & changes made in GenDate1 will change the GivenDate value.

REM ' Print "GivenDate = " & GivenDate 

 Function GetReferenceDt( ByRef GenDate1 )   ''''' GenDate1 becomes the reference of GivenDate, it can  be Modified.

               

                Print date1                 ''''' We can see only the copy of GivenDate value only here as well.

                GenDate1 = CDate(GenDate1)

                DD = Day(GenDate1)

                If DD <= 9 Then

                                DD ="0"&DD

                End If

                MM= Month(GenDate1)

                If MM <= 9 Then

                                MM ="0"&MM

                End If

                YY= Year(GenDate1)

                GenDate1 = MM&"/"&DD&"/"&YY

                Print GenDate1

End Function


REM '########################################################################################################################################################

REM '48. Next Decision Btn function is used to click and skip the X No. of <Next Decision >

REM '########################################################################################################################################################

Public Function NextDecisionBtnFun ( ndCount )

    Dim VarNextDeci
   
    Do Until ( VarNextDeci = ndCount )
   
        VarNextDeci = VarNextDeci + 1
   
        If     SwfWindow("SunNikACS").SwfWindow("Interactive Sales Wizard").SwfButton("Next Decision >").Exist(10) Then
                  
                   SwfWindow("SunNikACS").SwfWindow("Interactive Sales Wizard").SwfButton("Next Decision >").Click
              
               End If
              
               Wait(3)
   
    Loop

End Function


REM '########################################################################################################################################################              

REM '49.'VerifyEnabled function is to Verify Object Is Enabled

REM '########################################################################################################################################################     

Public Function VerifyEnabled (objND)

   Dim enable_property
   ''''' Get the enabled property from the test object
   enable_property = objND.GetROProperty("enabled")
   If enable_property <> 0 Then                     ''''' The value is True (anything but 0)
     Reporter.ReportEvent micPass, "Verify Enabled - Succeeded", "The Object Is Enabled"
     VerifyEnabled = True
   Else
     Reporter.ReportEvent micFail, "Verify Enabled - Failed", "The Object is NOT Enabled"
     VerifyEnabled = False
   End If
  
End Function


REM '########################################################################################################################################################              

REM '50.'VerifyDisabled function is to Verify Object Is Disabled

REM '########################################################################################################################################################     

Public Function VerifyDisabled (objND)

   Dim enable_property
   ''''' Get the enabled property from the test object
   enable_property = objND.GetROProperty("disabled")
   If enable_property = 0 Then                             ''''' The value is False (0) - Enabled
     Reporter.ReportEvent micPass, "Verify Disabled - Succeeded", "The Object Is Disabled"
     VerifyDisabled = True
   Else
     Reporter.ReportEvent micFail, "Verify Disabled - Failed", "The Object Is NOT Disabled"
     VerifyDisabled = False
   End If
  
End Function


REM '########################################################################################################################################################              

REM '51.'TestDataDate function is to Add Current date "MMDDYYYYY" to the TestData

REM '########################################################################################################################################################     
''''''  varMyNowDate = FormatDateTime(Date, 2)
''''''    Call TestDataDate(varMyNowDate)

Public Function TestDataDate(eDate)

    Set MyDate = DotNetFactory.CreateInstance("System.DateTime")
    Set oDate = MyDate.Parse(eDate)
    TestDataDate = oDate.ToString("MM/dd/yyyy")
    eDate = TestDataDate
    eDate  = Replace(eDate,"/","")
    Print eDate
    Set MyDate = Nothing

End Function


REM '########################################################################################################################################################              

REM '53.'MacFormater function is to Formats MAC Address from Account Number

REM '######################################################################################################################################################## 
'''''' VarMac = MacFormater(DataTable("AccountNo", "MCC_SunEnv_Sodi_CML 4 Lines_Comm"), "A" )
Function MacFormater(Account, letter)

    '''''' Formats MAC Address from Account Number
    Dim AccountTrim
    AccountTrim = Right(Account, 11)
    mac = AccountTrim & letter
    MacFormater = mid(mac,1,2)&":"&mid(mac,3,2)&":"&mid(mac,5,2)&":"&mid(mac,7,2)&":"&mid(mac,9,2)&":"&mid(mac,11,2)
   
End Function


REM '########################################################################################################################################################

REM '54.The anyBrowClose function is used to Close all tabs the existing browser

REM 'Function to close the existing browsers and all tabs

REM '########################################################################################################################################################

Public Function anyBrowClose(ByRef BrowserName)
               
    If Browser(BrowserName).Exist(5) Then

        Browser(BrowserName).CloseAllTabs

    End If

End Function


REM '########################################################################################################################################################

REM '55. Next Decision Btn Mwin function is used to click and skip the X No. of <Next Decision > along the window name

REM '########################################################################################################################################################

Public Function NextDecisionBtnMwin (ByRef MWinName, ndCount )

    Dim VarNextDeci
   
    Do Until ( VarNextDeci = ndCount )
   
        VarNextDeci = VarNextDeci + 1
   
'        If     SwfWindow("SunNikACS").SwfWindow("Interactive Sales Wizard").SwfButton("Next Decision >").Exist(10) Then
'                  
'                   SwfWindow("SunNikACS").SwfWindow("Interactive Sales Wizard").SwfButton("Next Decision >").Click
'              
'               End If
              
                    If     SwfWindow(MWinName).SwfWindow("Interactive Sales Wizard").SwfButton("Next Decision >").Exist(10) Then
                  
                   SwfWindow(MWinName).SwfWindow("Interactive Sales Wizard").SwfButton("Next Decision >").Click
              
               End If

               Wait(3)
   
    Loop

End Function



REM '########################################################################################################################################################              

REM '56.'The ClearBrowserCookiesFun function is to Clear the Browser Cookies

REM '######################################################################################################################################################## 

'''''' Set VarObjCBC = Browser("Suntro-Test")
'''''' Call ClearBrowserCookiesFun( VarObjCBC )

'''''' Clear cookies
Public Function ClearBrowserCookiesFun( ByCBCObjEx )
   
    ByCBCObjEx.highlight                                 ''''''  Ensuring for the browser is in the foreground
    Set oDelCookies = CreateObject("WScript.Shell")
    oDelCookies.SendKeys "^+{DELETE}"                    '''''''   '^ For Ctrl key, + For Shift key
    Wait 2                                                
    oDelCookies.SendKeys "{TAB 9}"                         ''''''  We need to tab 9 times to reach ClearBrowsingData button
    Wait 1
    oDelCookies.SendKeys "{ENTER}"
    Set oDelCookies = Nothing


End Function



REM '########################################################################################################################################################              

REM '57.'The ClearBrowserCookiesFun function is to Validate the if object exisit & wait for given time

REM '######################################################################################################################################################## 

'''''' Set VarobjMUINotthissite = Browser("SunNik Communications").WinObject("Notification").WinButton("Not for this site")
'''''' Call IfObjExistsFun( VarobjMUINotthissite, 3 )

'''''' Validate the if object exisit & wait for given time
Public Function IfObjExistsFun(ByObjEx, ByExi )
   
    If ByObjEx.Exist(ByExi) Then
       
        ByObjEx.Click
       
    End If

End Function



REM '########################################################################################################################################################              

REM '58.'The Browser_Minimize function is to Minimize the window

REM '######################################################################################################################################################## 
''''''  Browser("Suntro-Test").Page("Suntro-Test").highlight
''''''    Set VarObjMUImini = Browser("Suntro-Test")
''''''    Call Browser_Minimize(VarObjMUImini)

'''''' Minimizing the Window   
Public Function Browser_Minimize( ByObjMUImini )
               
    ''''' Find the handle for the Browser window

    '''''' hwnd = Browser("Suntro-Test").GetROProperty("hwnd")
    hwnd = ByObjMUImini.GetROProperty("hwnd")

    ''''' Check if the Browser is already Minimized or not

    If Window("hwnd:=" & hwnd).GetROProperty("Minimized") = True Then

      isMinimize = True

    Else

      isMinimize = False

    End If

   

    ''''' Check if the Browser is isMinimizable or not

    If Window("hwnd:=" & hwnd).GetROProperty("Minimizable") = True Then

      isMinimizable = True

    Else

      isMinimizable = False

    End If

   

    ''''' Minimize the browser window if it is not already Minimized and is Miimizable

    If isMinimized = False and isMinimizable = True Then

      Window("hwnd:=" & hwnd).Minimize

    End If

End Function



REM '########################################################################################################################################################              

REM '59.'MUITNsFun function is to Convert Suntro UI TN eg.(850) 614-5910 to Normal Number

REM '######################################################################################################################################################## 
'''''' VarUITN1Act1 = MuiTelNumsFun(VarUITN1Act)
Function MuiTelNumsFun(eVarUITN1Act)

       MuiTelNumsFun = trim(mid(eVarUITN1Act,2,3)&mid(eVarUITN1Act,7,3)&mid(eVarUITN1Act,11,4))
    'Print MuiTelNumsFun                               
   
End Function



REM '########################################################################################################################################################              

REM '60.'RepMuiTelNumsFun function is to Replace the special characters in Suntro UI TN eg.(850) 614-5910 to Normal Number

REM '######################################################################################################################################################## 
'''''' VarUITN4Act1 = RepMuiTelNumsFun(VarUITN4Act,"(",")"," ","-")


Function RepMuiTelNumsFun(eVarUITN1Act1a, eVarUITN1Act1, eVarUITN1Act2, eVarUITN1Act3,eVarUITN1Act4)

               eVarUITN1Act1a = Trim(Replace(eVarUITN1Act1a,eVarUITN1Act1,""))
            eVarUITN1Act1a = Trim(Replace(eVarUITN1Act1a,eVarUITN1Act2,""))
            eVarUITN1Act1a = Trim(Replace(eVarUITN1Act1a,eVarUITN1Act3,""))
            eVarUITN1Act1a = Trim(Replace(eVarUITN1Act1a,eVarUITN1Act4,""))
           
            RepMuiTelNumsFun = eVarUITN1Act1a            ''''' Retrun the Value to the function
            'Print RepMuiTelNumsFun                               
   
End Function


REM '########################################################################################################################################################              

REM '61.'MyBrowserOpt function is to open my opted Browser

REM '########################################################################################################################################################     
''''''varMyBrowser =  DataTable("MccBrowser", dtGlobalSheet)
''''''Call MyBrowserOpt(varMyBrowser)
''''''systemutil.Run  Chr(34) & varMyBrowser &Chr(34)

Public Function MyBrowserOpt(eMyBrowser)

    If UCase(Trim(eMyBrowser)) = "I" then
            eMyBrowser = "iexplore.exe"
    Else If UCase(Trim(eMyBrowser))  = "C" Then
            eMyBrowser = "chrome.exe"
         Else if UCase(Trim(eMyBrowser)) = "F" then
                    eMyBrowser = "firefox.exe"
              End if
         End if
    End If
   
End Function

REM '########################################################################################################################################################              

REM '62.LoginCredentials function is to login to the Browser

REM '########################################################################################################################################################     

Public Function LoginCredentials(ByUsr, ByPwd)
   
    ''''' If UCase(Trim(DataTable("SunEnv_Application", dtGlobalSheet))) = "SunEnv" and UCase(Trim(DataTable("SunEnv_UserName", dtGlobalSheet))) <> " " Then
   
        ByUsr = DataTable("SunEnv_UserName", dtGlobalSheet)
        ByPwd = DataTable("SunEnv_Password", dtGlobalSheet)
       
    ''''' End If

End Function




REM '########################################################################################################################################################              

REM '63.'The ClearBrowserCookiesChrm function is to Clear the Browser Cookies - For Chrome

REM '######################################################################################################################################################## 

'''''' Set VarObjCBC = Browser("SunNik Communications")
'''''' Call ClearBrowserCookiesChrm( VarObjCBC1 )

'''''' Clear cookies
Public Function ClearBrowserCookiesChrm( ByCBCObjEx1 )
   
    ByCBCObjEx1.highlight                                 ''''''  Ensuring for the browser is in the foreground
    Set oDelCookies = CreateObject("WScript.Shell")
    oDelCookies.SendKeys "^+{DELETE}"                    '''''''   '^ For Ctrl key, + For Shift key
    Wait 2                                                
    oDelCookies.SendKeys "{TAB 9}"                         ''''''  We need to tab 9 times to reach ClearBrowsingData button
    Wait 1
    oDelCookies.SendKeys "{ENTER}"
    Set oDelCookies = Nothing


End Function

REM '########################################################################################################################################################              

REM '64 .'The MyVarUI_Service function is to validate the service

REM '######################################################################################################################################################## 

''''''  varUIService = VarCusOrdDiscowifiStatusAct
       
'''''' Call MyVarUI_Service ( varUIService, varServ, varServStatus )


Public Function MyVarUI_Service( eVarUIService, eVarServ, evarServStatus )
   

    VarUI_Service = split(eVarUIService, " ")

    For i=lbound(VarUI_Service) to ubound(VarUI_Service)
        If UCase(Trim( VarUI_Service(1))) = "WIFI" then
                Print " This is Wifi : "& VarUI_Service(1)
                eVarServ = "WIFI"
                evarServStatus = UCase(Trim( VarUI_Service(2)))
                Exit For
        Else If UCase(Trim( VarUI_Service(1))) = "HSD" then
                    Print " This is HSD : "& VarUI_Service(1)
                    eVarServ = "HSD"
                    evarServStatus = UCase(Trim( VarUI_Service(2)))
                    Exit For
             Else If UCase(Trim( VarUI_Service(1))) = "PHONE" then
                    Print " This is PHONE : "& VarUI_Service(1)
                    eVarServ = "PHONE"
                    evarServStatus = UCase(Trim( VarUI_Service(2)))
                    Exit For
                        Exit For
                  End if
             End if
        End if
    Next
   
   
End Function


REM '########################################################################################################################################################              

REM '64 .'The MyVarUI_ServiceCOMPLETE function is to validate the service

REM '######################################################################################################################################################## 

''''''  varUIService = VarCusOrdDiscowifiStatusAct
       
'''''' Call MyVarUI_ServiceCOMPLETE ( varUIService, varServ, varServStatus )


Public Function MyVarUI_ServiceCOMPLETE( eVarUIService, eVarServ, evarServStatus )
   

    VarUI_Service = split(eVarUIService, " ")

    For i=lbound(VarUI_Service) to ubound(VarUI_Service)
        If UCase(Trim( VarUI_Service(2))) = "WIFI" then
                Print " This is Wifi : "& VarUI_Service(1)
                eVarServ = "WIFI"
                evarServStatus = UCase(Trim( VarUI_Service(2)))
                Exit For
        Else If UCase(Trim( VarUI_Service(2))) = "HSD" then
                    Print " This is HSD : "& VarUI_Service(1)
                    eVarServ = "HSD"
                    evarServStatus = UCase(Trim( VarUI_Service(2)))
                    Exit For
             Else If UCase(Trim( VarUI_Service(2))) = "PHONE" then
                    Print " This is PHONE : "& VarUI_Service(1)
                    eVarServ = "PHONE"
                    evarServStatus = UCase(Trim( VarUI_Service(2)))
                    Exit For
                        Exit For
                  End if
             End if
        End if
    Next
   
   
End Function



REM '########################################################################################################################################################              

REM '64 .'The MyVarUI_Service_DiscoCom function is to validate the service

REM '######################################################################################################################################################## 

''''''  varUIService = VarCusOrdDiscowifiStatusAct
       
'''''' Call MyVarUI_Service_DiscoCom ( varUIService, varServ, varServStatus )


Public Function MyVarUI_Service_DiscoCom ( eVarUIService, eVarServ, evarServStatus )
   

    VarUI_Service = split(eVarUIService, " ")

    For i=lbound(VarUI_Service) to ubound(VarUI_Service)
        If UCase(Trim( VarUI_Service(1))) = "WIFI" then
                Print " This is Wifi : "& VarUI_Service(1)
                eVarServ = "WIFI"
                evarServStatus = UCase(Trim( VarUI_Service(2)))
                'Print UCase(Trim( VarUI_Service(1)))
                'Print UCase(Trim( VarUI_Service(2)))
                Exit For
        Else If UCase(Trim( VarUI_Service(1))) = "HSD" then
                    Print " This is HSD : "& VarUI_Service(1)
                    eVarServ = "HSD"
                    evarServStatus = UCase(Trim( VarUI_Service(2)))
                    'Print UCase(Trim( VarUI_Service(1)))
                'Print UCase(Trim( VarUI_Service(2)))
                    Exit For
             Else If UCase(Trim( VarUI_Service(1))) = "PHONE" then
                    Print " This is PHONE : "& VarUI_Service(1)
                    eVarServ = "PHONE"
                    evarServStatus = UCase(Trim( VarUI_Service(2)))
                    'Print UCase(Trim( VarUI_Service(1)))
                    'Print UCase(Trim( VarUI_Service(2)))
                    Exit For
                        Exit For
                  End if
             End if
        End if
    Next
   
   
End Function



REM '########################################################################################################################################################              

REM '65 .'The ObjExistsLooping function is to wait for the object by looping

REM '######################################################################################################################################################## 


'''''' Validate the if object exisit & wait for given time and looping it for the exisiting.
'''''' ByExi as 500
'''''' Set VarObjCustomerStatus = Browser("SunNik Communications").Page("SunNik Communications_2").WebElement("customerStatus")
'''''' Call ObjExistsLooping( VarObjCustomerStatus )

Public Function ObjExistsLooping(ByObjEx, ByExi)
    ObjExistsLooping = false
    Setting("DefaultTimeout") = 1000000
    For i = 0 to 100
        '''''' Print "I am Waiting......."
        If ByObjEx.Exist(ByExi) Then
           
            ObjExistsLooping = true
            ByObjEx.highlight
            '''''' Print "I reached .........."
            Exit For
        End If
    Next
    Setting("DefaultTimeout") = 1500000
End Function


REM '########################################################################################################################################################              

REM '66 .'The MyClickNextTab function is to Clcik the NEXT button on the Tabs

REM '######################################################################################################################################################## 
'''''' MyClickNextTab function is to Clcik the NEXT button on the Tabs

'''''' Call MyClickNextTab( 5 )

Function MyClickNextTab (VarTabCnt)

   Dim iNxtTb
  
   For iNxtTb = 1 to VarTabCnt
   
        '''''' Print "Tab Next : " &iNxtTb
           '''''' MsgBox iNxtTb
           SwfWindow("SunNikACS_4").SwfWindow("Edit Service Order : 06282017S").SwfObject("Next").Click
          
   Next
  
End Function



REM '########################################################################################################################################################              

REM '67 .'The MyClickNextTabFun function is to Clcik the NEXT button on the Tabs through Objects

REM '######################################################################################################################################################## 
'''''' MyClickNextTabFun function is to Clcik the NEXT button on the Tabs through Objects
'''''' Set VarObjNxtTab = SwfWindow("SunNikACS_4").SwfWindow("Edit Service Order : 06282017S").SwfObject("Next")   

'''''' Call MyClickNextTabFun( VarObjNxtTab, 5 )

Function MyClickNextTabFun (VarNextTab1, VarTabCnt)

   Dim iNxtTb
  
   For iNxtTb = 1 to VarTabCnt
  
        '''''' Print "Tab Next : " &iNxtTb
           '''''' MsgBox  iNxtTb
           VarNextTab1.Click
          
   Next
  
End Function




REM '########################################################################################################################################################              

REM '68 .'The MyPwdEncryptorFun function is to encrypt the given Texts

REM '######################################################################################################################################################## 
'''''' MyPwdEncryptorFun function is to encrypt the given Texts

'''''' Call MyPwdEncryptorFun (  )

Function MyPwdEncryptorFun()

    Dim VarDecrypt , VarEncrypt
    VarDecrypt = InputBox("Enter your name")
    MsgBox ("You entered: " &VarDecrypt)
   
   
               VarDecrypt  = Replace(VarDecrypt,"0","S")
            VarDecrypt  = Replace(VarDecrypt,"1","U")
             VarDecrypt  = Replace(VarDecrypt,"2","N")
             VarDecrypt  = Replace(VarDecrypt,"3","D")
             VarDecrypt  = Replace(VarDecrypt,"4","A")
            
               VarDecrypt  = Replace(VarDecrypt,"5","R")
            VarDecrypt  = Replace(VarDecrypt,"6","T")
             VarDecrypt  = Replace(VarDecrypt,"7","E")
             VarDecrypt  = Replace(VarDecrypt,"8","C")
             VarDecrypt  = Replace(VarDecrypt,"9","H")
            
     VarEncrypt = VarDecrypt
     MsgBox ("Your Encrypted : " &VarEncrypt)
     Print VarEncrypt 

 End Function


 REM '########################################################################################################################################################              

REM '69 .'The MyVarUI_Service_TransferCom function is to validate the service

REM '######################################################################################################################################################## 

''''''    varUIService = VarCusOrdTransferPhoneStatusAct
           
       
'''''' Call MyVarUI_Service_TransferCom ( varUIService, varServ, varServStatus )

 Public Function MyVarUI_Service_TransferCom ( eVarUIService, eVarServ, evarServStatus )
   

    VarUI_Service = split(eVarUIService, " ")

    For i=lbound(VarUI_Service) to ubound(VarUI_Service)
        If UCase(Trim( VarUI_Service(1))) = "WIFI" then
                Print " This is Wifi : "& VarUI_Service(1)
                eVarServ = "WIFI"
                evarServStatus = UCase(Trim( VarUI_Service(2)))
                'Print UCase(Trim( VarUI_Service(1)))
                'Print UCase(Trim( VarUI_Service(2)))
                Exit For
        Else If UCase(Trim( VarUI_Service(1))) = "HSDADD-IP" then
                    Print " This is HSD : "& VarUI_Service(1)
                    eVarServ = "HSDADD-IP"
                    evarServStatus = UCase(Trim( VarUI_Service(2)))
                    'Print UCase(Trim( VarUI_Service(1)))
                'Print UCase(Trim( VarUI_Service(2)))
                    Exit For
             Else If UCase(Trim( VarUI_Service(1))) = "PHONE" then
                    Print " This is PHONE : "& VarUI_Service(1)
                    eVarServ = "PHONE"
                    evarServStatus = UCase(Trim( VarUI_Service(2)))
                    'Print UCase(Trim( VarUI_Service(1)))
                    'Print UCase(Trim( VarUI_Service(2)))
                    Exit For
                        Exit For
                  End if
             End if
        End if
    Next
   
   
End Function

No comments:

Post a Comment