Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
light example
#1
Solved: 10 Years, 9 Months, 1 Week ago
[b]Hi I have written the below shown code in seprate function library file so that I can remove the use of Object repository.

'##################################
'#Dialog
'##################################
Code:
Public Sub DPDialog(strlnDialogName,strnProp)
    objDialog =  strlnDialogName
    Set obj_Dialog = Description.Create  
    obj_Dialog ("Class Name").value = "Dialog"
    obj_Dialog ("regexpwndtitle").value= strlnDialogName    

    If strnProp = "Click"  Then ' Click Property
        Dialog(strlnDialogName).Click
    End If
    
End Sub


'####################################
'# WinEdit
'####################################

Code:
Public sub DBWinEdit(strenWinEdit,strlnValue,strnProp)
        Set obj_WinEdit = Description.Create  
        obj_WinEdit ("Class Name").value = "WinEdit"
        obj_WinEdit ("attached text").value= strenWinEdit        

      If  strnProp = "Set" Then ' Set Property
           Dialog(obj_Dialog).WinEdit(obj_WinEdit).Set strlnValue
      End If
          
End Sub

'######################################
'# WinButton
'######################################
Code:
Public Sub DPWinButton(strWInButton,strnProp)
        Set obj_WinButton= Description.Create  
        obj_WinButton ("Class Name").value = "WinButton"
        obj_WinButton ("regexpwndtitle").value= strWInButton        

        If strnProp ="Click" Then ' Click Property
            Dialog(obj_Dialog).WinEdit(obj_WinButton).Click
       End If
    
End Sub

'##############################################
Now I have written the below code to use the above functions and taking the object's name and its property from Excel sheet.



Code:
Call OpenExcel(sFileName, vSheet) 'Open Data File
              object = ReadExcelDataSingle(sFileName, Row, "Object", vSheet)
    Call CloseExcel(sFileName) 'Close Data File
    
   If  object = "Dialog" Then
       Call OpenExcel(sFileName, vSheet) 'Open Data File
       winName =  ReadExcelDataSingle(sFileName, Row, "ObjectName", vSheet)
       objProperty = ReadExcelDataSingle(sFileName, Row, "Property", vSheet)
       Call CloseExcel(sFileName) 'Close Data File
       Call  DPDialog(winName,objProperty)
   End If
    
    If  object = "WinEdit" Then
        Call OpenExcel(sFileName, vSheet) 'Open Data File
        objName = ReadExcelDataSingle(sFileName, Row, "ObjectName", vSheet)
        objProperty = ReadExcelDataSingle(sFileName, Row, "Property", vSheet)
        objVal = ReadExcelDataSingle(sFileName, Row, "Value", vSheet)
       Call CloseExcel(sFileName) 'Close Data File
       Call DBWinEdit(objName,objVal,objProperty)
    End If

   If  object = "WinButton" Then
         Call OpenExcel(sFileName, vSheet) 'Open Data File
         objName = ReadExcelDataSingle(sFileName, Row, "ObjectName", vSheet)
         objProperty = ReadExcelDataSingle(sFileName, Row, "Property", vSheet)
         Call CloseExcel(sFileName) 'Close Data File
         Call DPWinButton(objName,objProperty)
  End If

##############################################

When I remove Object Repository refrence the code doesnot work.
Can Anyone tell what is wrong in above code.
Reply


Messages In This Thread
light example - by Amit Singh Chauhan - 06-04-2008, 06:54 PM
RE: light example - by somisays - 06-05-2008, 12:38 AM
RE: light example - by Amit Singh Chauhan - 06-05-2008, 09:44 AM
RE: light example - by Anshoo Arora - 06-05-2008, 04:09 AM
RE: light example - by Anshoo Arora - 06-05-2008, 10:18 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)