06-04-2008, 06:54 PM
[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
'##################################
'####################################
'# WinEdit
'####################################
'######################################
'# WinButton
'######################################
'##############################################
Now I have written the below code to use the above functions and taking the object's name and its property from Excel sheet.
##############################################
When I remove Object Repository refrence the code doesnot work.
Can Anyone tell what is wrong in above code.
'##################################
'#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.