标题: For help [打印本页] 作者: liuyu276 时间: 2007-12-19 10:00 标题: For help 大虾们帮忙看看下面代码有什么问题, 急!!!
'=======================================================================================================
'Function Name :TransformationMainTree_OpenStepEditPage
'Description :Open the Edit Step page from Main Tree Veiw
'Syntax :TransformationMainTree_OpenStepEditPage(StepName, LogMsg)
' StepName=>The step's name, which is under transformation main tree
'Example :TransformationMainTree_OpenStepEditPage("Audit", LogMsg)
'Author :Gareth
'Create Date :12/18/2007
Function TransformationMainTree_OpenStepEditPage(StepName, LogMsg)
' Open the Transformation Main Tree first
If Not MainTreeView.Exist(2) Then
Call LeftTreeMenu_Open("Main Tree", "", LogMsg)
End If
MainTreeView.ExpandAll("Transformations")
' Get the Object's Name
Call GetObjectName()
Wait(2)
MainTreeView.Select "Transformations;"&ObjectName&";Steps"
Dim WshShell, StepSelection, i, j
Set WshShell = CreateObject("WScript.Shell")
i = 0
'check the number of steps under Transformation Main Tree
While StepSelection<>"Transformations;"&ObjectName&";Hops"
WshShell.SendKeys "{DOWN}"
StepSelection = MainTreeView.GetROProperty("selection")
' i stands for the times expressed by inputting the "DOWN" arrow from Keyboard.
i = i+1
Wend
MainTreeView.Select "Transformations;"&ObjectName&";Steps"
' Check whether the step exists in the transformation main tree view
For j = 0 To i
WshShell.SendKeys "{DOWN}"
StepSelection = MainTreeView.GetROProperty("selection")
'If the step exists, then exit the cycle
If StepSelection = "Transformations;"&ObjectName&";Steps;"&StepName Then
LogMsg = "The step exists in the Transformation Main Tree View"
TransformationMainTree_OpenStepEditPage = "Pass|"&LogMsg
Reporter.ReportEvent 0, "TransformationMainTree_OpenStepEditPage", LogMsg
End If
Exit For
Next
'If the step not exists
If StepSelection = "Transformations;"&ObjectName&";Hops" Then
LogMsg = "The step is not existed in the Main Tee View"
TransformationMainTree_OpenStepEditPage = "Fail|"&LogMsg
Reporter.ReportEvent 1, "TransformationMainTree_OpenStepEditPage", LogMsg
Exit Function
Else
'Open the edit step page by inputting "Enter" from keyboard
MainTreeView.Type micReturn
End If
' Check whether the Edit step page dialog exists
If WFDWindow.Dialog("regexpwndtitle:=.*").Exist(2) Then
LogMsg = "Open the EditStepPage successfully"
TransformationMainTree_OpenStepEditPage = "Pass|"&LogMsg
Reporter.ReportEvent 0, "TransformationMainTree_OpenStepEditPage", LogMsg
Else
LogMsg = "Fails to open the EditStepPage"
TransformationMainTree_OpenStepEditPage = "Fail|"&LogMsg
Reporter.ReportEvent 1, "TransformationMainTree_OpenStepEditPage", LogMsg
End If