'Core points of this execise:
'1. Judge whether Calculator exist or not
'2. Judge run cycle from data table, not in File->Setting
'3. Object property set in code, not by Object Repository
'4. Output result to data table
'5. Reporter read from data table
'If calculater does not exist, then open it; else clear it=0
If not Window("Calculator").Exist Then
SystemUtil.Run "C:\WINDOWS\system32\calc.exe","","C:\WINDOWS\system32","open"
else
Window("Calculator").WinButton("C").Click
End If
'Define to object property
dim oB
Set oB=description.Create()
Dim i, iRow
Dim str
'Read all rows in datatable, instead of setting in File->Setting
iRow=DataTable.GetSheet("Calculate").GetRowCount
For i=1 to iRow
DataTable.GetSheet("Calculate").SetCurrentRow i
'Data moved from Global sheet to local sheet
' Object property set in code
oB("text").value=DataTable("V1", dtLocalSheet)
Window("Calculator").WinButton(oB).Click
oB("text").value="\" &datatable("V3",dtLocalSheet)
Window("Calculator").WinButton(oB).Click
oB("text").value=datatable("V2",dtLocalSheet)
Window("Calculator").WinButton(oB).Click
Window("Calculator").WinButton("+").Click
oB("text").value=datatable("V1",dtLocalSheet)
Window("Calculator").WinButton(oB).Click
oB("text").value="\" &datatable("V3",dtLocalSheet)
Window("Calculator").WinButton(oB).Click
oB("text").value=datatable("V2",dtLocalSheet)
Window("Calculator").WinButton(oB).Click
Window("Calculator").WinButton("=").Click
'Output the result to database
Window("Calculator").WinEdit("Edit").Output CheckPoint("Edit_2")
'msgbox (Window("Calculator").WinEdit("Edit").Check (CheckPoint("Edit_2")))
'Reporter
str=datatable("V1",dtLocalSheet) & datatable("V3",dtLocalSheet) & datatable("V2",dtLocalSheet) & "+" & datatable("V1",dtLocalSheet) & datatable("V3",dtLocalSheet) & datatable("V2",dtLocalSheet) & "=" & datatable("Re",dtLocalSheet)
Reporter.ReportEvent micPass, "ADD", str
Next
'Clear it
Set oB=nothing
Window("Calculator").Close
Object property set in code, not by Object RepositoryObject property set in code, not by Object Repository