此文章转的
此框架是从SAFFRON框架改的,据作者说是优化版,收了,以后查用。不错的自动化开发测试框架。
‘***************************************************************************************************************************************
'定义全局变量以便于该框架函数WorkUnderFrame 的运行,否则变量无法共享传递
‘***************************************************************************************************************************************
Dim frameDesc:frameDesc = ""
Dim objectArray:objectArray =
Split("Link,WebButton,WebList,WebEdit,Image,WebTable,Viewlink,WebArea,WebCheckBox,WebFile,WebRadioGroup,WebElement", ",")
‘***************************************************************************************************************************************
'设计说明:关闭所有打开的IE,避免使用CloseProcessByName 这种容易造成IE 崩溃的粗鲁办法
'程序输入:无
'程序输出:无
'设计人员:LIUYI027
'设计时间:2011-01-11
'调用举例:CloseAllOpenedBrowsers
‘***************************************************************************************************************************************
Public Sub CloseAllOpenedBrowsers
Set Wshshell = CreateObject("Wscript.Shell")
Set DialogObject = Description.Create()
DialogObject("micclass").Value = "Dialog"
Set Windows32Dialog = Desktop.ChildObjects(DialogObject)
dlNum = Windows32Dialog.Count - 1
For v = 0 to dlNum
Windows32Dialog(v).Close
Next
Set Windows32Dialog = Nothing
Set theBrowser = Browser("micclass:=Browser", "index:=0")
While theBrowser.Exist(0)
theBrowser.Close
waitNx = 1
Do While waitNx < 5
Set Windows32Dialog = Desktop.ChildObjects(DialogObject)
dlNum = Windows32Dialog.Count - 1
For v = 0 to dlNum
dlText = Windows32Dialog(v).GetROProperty("regexpwndtitle")
Wshshell.AppActivate(dlText)
Wait(1)
Wshshell.SendKeys "{ENTER}"
Next
Set Windows32Dialog = Nothing
waitNx = waitNx + 1
Loop
Report micPass,"使用CloseAllOpenedBrowsers 函数页面关闭成功","当前页面关闭成功!"
Wend
Set theBrowser = Nothing
Set DialogObject = Nothing
Set Wshshell = Nothing
End Sub
‘***************************************************************************************************************************************
'设计说明:最大化IE 浏览器
'程序输入:无
'程序输出:无
'设计人员:LIUYI027
'设计时间:2011-01-11
'调用举例:MaximizeBrowser
‘***************************************************************************************************************************************
Public Sub MaximizeBrowser
Set BrowserObject = Description.Create()
BrowserObject("NativeClass").Value = "IEFrame"
Set WindowsBrowser = Desktop.ChildObjects(BrowserObject)
brNum = WindowsBrowser.Count - 1
For i = 0 To brNum
ieVersion = WindowsBrowser(i).GetROProperty("version")
wndTitle = WindowsBrowser(i).GetROProperty("title")
Set ObjectBrowser = Browser("micclass:=Browser", "index:=" & i)
If Instr(ieVersion,6) > 0 Then
Window("regexpwndclass:=IEFrame","index:=0","text:=" & wndTitle & ".*").Maximize
Else
WindowsBrowser(i).Maximize
End If
Set ObjectBrowser = Nothing
Next
Set WindowsBrowser = Nothing
Set BrowserObject = Nothing
End Sub
‘***************************************************************************************************************************************
'设计说明:初始化所有打开的Browser 页面
'程序输入:无
'程序输出:初始化成功或者失败
'设计人员:LIUYI027
'设计时间:2011-01-11
'调用举例:BrowserSync
‘***************************************************************************************************************************************
Public Function SyncronizeBrowser()
Dim bolVal1:bolVal1 = False
Dim bolVal2:bolVal2 = False
Dim bolVal3:bolVal3 = False
Dim bolVal4:bolVal4 = False
Dim binx:binx = 0
Dim ex:ex = 0
If Browser("micclass:=Browser", "CreationTime:=0").Exist(0) Then
Browser("micclass:=Browser", "CreationTime:=0").Sync
Else
SyncronizeBrowser = False
Report micWarning ,"初始化页面失败","页面初始化失败,需要重新操作!"
Exit Function
End If
Set BrowserObject = Description.Create()
BrowserObject("micclass").Value = "Browser"
Set WindowsBrowser = Desktop.ChildObjects(BrowserObject)
For binx = 0 to WindowsBrowser.Count - 1
WindowsBrowser(binx).Sync
Do Until ex = 10
bolVal1 = (WindowsBrowser(binx).GetROProperty("url") <> "")
bolVal2 = WindowsBrowser(binx).GetROProperty("openurl") <> ""
bolVal3 = WindowsBrowser(binx).GetROProperty("name") <> ""
bolVal4 = WindowsBrowser(binx).GetROProperty("title") <> ""
If (bolVal1 And bolVal3) Or (bolVal1 And bolVal4) Or (bolVal2 And bolVal3) Or (bolVal2 And bolVal4) Then
Exit Do
Else
Wait(1)
End If
ex = ex + 1
Loop
Next
Set WindowsBrowser = Nothing
Set BrowserObject = Nothing
SyncronizeBrowser = True
End Function
‘***************************************************************************************************************************************
'设计说明:打开指定的地址,并且初始化页面,特别说明:对于地址栏出现一次性sessionid 的网页不可用该函数
'程序输入:url 地址
'程序输出:初始化成功或者失败
'设计人员:LIUYI027
'设计时间:2011-01-11
'调用举例:print NavigateBrowser ("www.baidu.com")
‘***************************************************************************************************************************************
Public Function NavigateBrowser(para_myuri)
CloseAllOpenedBrowsers
Set IEBrowser = CreateObject("InternetExplorer.Application")
IEBrowser.Visible = True
IEBrowser.Navigate para_myuri
Set ObjectBrowser = Browser("micclass:=Browser", "index:=0")
Do Until SyncronizeBrowser() = True
Wait(1)
Loop
actualurl = ObjectBrowser.GetROProperty("url")
'下面这个判断主要是为了解决初始化地址跳转问题,如果URL 发生变化会导致对象属性发生变化从而导致运行错误。
If actualurl <> para_myuri Then
ObjectBrowser.Close
Set IEBrowser = Nothing
Set IEBrowser = CreateObject("InternetExplorer.Application")
IEBrowser.Visible = True
IEBrowser.Navigate actualurl
If Not SyncronizeBrowser() Then
Report MicWarning,"使用NavigateBrowser 函数IE 初始化失败","打开指定页面【" & para_myuri & "】在初始化的时候失败!"
Set MyBrowser = Nothing
Set IEBrowser = Nothing
Exit Function
End If
End If
Set ObjectBrowser = Nothing
Set IEBrowser = Nothing
Report MicPass,"使用NavigateBrowser 函数IE 初始化成功","打开指定页面【" & para_myuri & "】并且初始化成功!"
NavigateBrowser = True
End Function
‘***************************************************************************************************************************************
'设计说明:处理弹出对话框,主要用于弹出的可预知性能够得到控制的地方,未知弹出需引用其他函数处理
'程序输入:选择对话框操作:是/否/确认/取消/确定等等,是否需要向结果中添加提示信息的报告
'程序输出:结果报告
'设计人员:LIUYI027
'设计时间:2011-01-11
'调用举例:HandleDialog "确.*定","Y"
‘***************************************************************************************************************************************
Public Function HandleDialog(btText,needAlertInfo)
Dim buttonName:buttonName = ""
Dim btName:btName = ""
Dim binx:binx = 0
Dim inx:inx = 0
Dim dialogTitle:dialogTitle = ""
If Trim(btText) = "" Then
buttonName = "任意按钮"
Else
buttonName = btText
End If
Set Wshshell = CreateObject("Wscript.Shell")
Set DialogObject = Description.Create()
DialogObject("micclass").Value = "Dialog"
Set WindowsDialog = Desktop.ChildObjects(DialogObject)
If WindowsDialog.Count - 1 < 0 Then
Set WindowsDialog = Nothing
Set DialogObject = Nothing
Set Wshshell = Nothing
Report micDone,"已经没有任何弹出框","不需要进行对话框处理!"
Exit Function
End If
For inx = 0 to WindowsDialog.Count - 1
If needAlertInfo = "Y" Or needAlertInfo = True Then
Set StaticObject = Description.Create()
StaticObject("micclass").Value = "Static"
Set WindowsStatic = WindowsDialog(inx).ChildObjects(StaticObject)
disMessage = WindowsStatic(WindowsStatic.Count - 1).GetROProperty("text")
Report micDone,"获取网页对话框信息成功:",disMessage
Set WindowsStatic = Nothing
Set StaticObject = Nothing
End If
Set WinButtonObject = Description.Create()
WinButtonObject("micclass").Value = "WinButton"
Set WindowsButton = WindowsDialog(inx).ChildObjects(WinButtonObject)
Do While binx <= WindowsButton.Count - 1
btName = Trim(WindowsButton(binx).GetROProperty("text")) & "任意按钮"
If Instr(btName,buttonName) > 0 Then
WindowsButton(binx).Click
Report micDone,"函数HandleDialog 点击指定按钮成功","按照指定的按钮名称【" & btText & "】查找并点击按钮成功!"
Exit Do
End If
binx= binx + 1
Loop
Set WindowsButton = Nothing
Set WinButtonObject = Nothing
Next
Set WindowsDialog = Nothing
Set DialogObject = Nothing
Set Wshshell = Nothing
End Function
‘***************************************************************************************************************************************
'设计说明:为Browser、Window、Page、Frame 生成描述性语言,为后续做执行用,从SAFFRON 改造得来
'程序输入:1.当前操作页面在所有打开的页面中的排序(从1 开始),2.是否模态窗口
'程序输出:描述性语言字符串
'设计人员:LIUYI027
'设计时间:2011-01-11
'调用举例:GenerateDescription (2,"N")
‘***************************************************************************************************************************************
Public Function GenerateDescription (brNumber,ifModule)
Dim brinx:brinx = brNumber - 1
Dim windex:windex = ""
Dim bindex:bindex = ""
Dim descString:descString = ""
If ifModule = "Y" Or ifModule = True Then
descString = "Window(" & Quote("nativeclass:=Internet Explorer_TridentDlgFrame") & "," & Quote("Location:=0") & ")." & "Page(" &
Quote("micclass:=Page") & "," & Quote("index:=0") & ")."
Else
bindex = "CreationTime:=" & brinx
descString = "Browser(" & Quote("micclass:=Browser") & "," & Quote(bindex) & ")." & "Page(" & Quote("micclass:=Page") & "," &
Quote("index:=0") & ")."
End If
descString = descString & frameDesc
GenerateDescription = descString
End Function
‘***************************************************************************************************************************************
'设计说明:为WEB 其他实例对象生成描述性语言,为后续做执行用,从SAFFRON 改造得来
'程序输入:1.对象类名,2.指定的属性和值比如"name:=姓名"
'程序输出:描述性语言字符串
'设计人员:LIUYI027
'设计时间:2011-01-11
'调用举例:GenerateobjectDescription ("Link","text:=Name")
‘***************************************************************************************************************************************
Public Function GenerateObjectDescription (objClassName, otherAtt)
Dim objNameString:objNameString = ""
Dim objNx:objNx = IndexOf(objectArray, objClassName)
If objNx >= 0 Then
objNameString = objClassName & "(" & Quote("micclass:=" & objClassName) & "," & Quote(otherAtt) & "," & Quote("index:=0") & ")"
End If
GenerateobjectDescription = objNameString
End Function
‘***************************************************************************************************************************************
'设计说明:为每一种Web 类生成对象,
'程序输入:1.类名,2.关键识别属性:Link、WebElement、Viewlink、WebTable 使用innertext 属性,支持右模糊匹配
'Window 使用text、Browser 使用title,Page 无需特别标注,其余皆使用name,支持左中右模糊匹配3.页面层次序号,4.
是否模态窗口
'程序输出:Web 对象,支持后续的QTP 内置方法
'设计人员:LIUYI027
'设计时间:2011-01-11
'调用举例:msgbox GenerateSpecifiedObject("WebTable","搜索开放平台",1,"N").GetROProperty("text")
‘***************************************************************************************************************************************
Public Function GenerateSpecifiedObject (className, attValue, brNumber, ifModule)
Dim objectString:objectString = ""
Dim textDesc: textDesc = ""
Dim MySpecifiedObject:MySpecifiedObject = ""
Dim blVal1:blVal1 = (UCase(className) = "LINK")
Dim blVal2:blVal2 = (UCase(className) = "WEBELEMENT")
Dim blVal3:blVal3 = (UCase(className) = "VIEWLINK")
Dim blVal4:blVal4 = (UCase(className) = "WEBTABLE")
If blVal1 Or blVal2 Or blVal3 Or blVal4 Then
textDesc = "innertext:=" & attValue & ".*"
objectString = GenerateDescription(brNumber, ifModule) & GenerateObjectDescription(className, textDesc)
Execute "Set MySpecifiedObject = " & objectString
Elseif Ucase(className) = "WINDOW" Then
Set MySpecifiedObject = Window("nativeclass:=Internet Explorer_TridentDlgFrame", "text:=.*" & attValue & ".*","Location:=0")
Elseif Ucase(className) = "BROWSER" Then
Set MySpecifiedObject = Browser("micclass:=Browser", "title:=.*" & attValue & ".*","CreationTime:=0")
Elseif Ucase(className) = "PAGE" Then
textDesc = GenerateDescription(brNumber, ifModule)
Execute "Set MySpecifiedObject = " & Left(textDesc,Len(textDesc) - 1)
Else
textDesc = "name:=.*" & attValue & ".*"
objectString = GenerateDescription(brNumber, ifModule) & GenerateObjectDescription(className, textDesc)
Execute "Set MySpecifiedObject = " & objectString
End If
Set GenerateSpecifiedObject = MySpecifiedObject
End Function
‘***************************************************************************************************************************************
'设计说明:根据关键字(可正则模糊)查询页面对象,取消SAFRRON 中对Page 和Frame 的检查,新增Web 其他对象
'程序输入:1.对象类名,2.内置属性的值如“查.*询.*”,3.页面层次(Browser 对象)序号,4.是否模态窗口
'程序输出:找到则返回Ture 否则为False,并且添加结果报告
'设计人员:LIUYI027
'设计时间:2011-01-11
'调用举例:FindSpecifiedObject "WebTable","搜索开放平台",1,"N"
‘***************************************************************************************************************************************
Public Function FindSpecifiedObject (objectClass, specifiedText, brNumber, ifModule)
Dim boolValue:boolValue = False
Dim specifiedAtt:specifiedAtt = ""
Dim blVal1:blVal1 = (UCase(className) = "LINK")
Dim blVal2:blVal2 = (UCase(className) = "WEBELEMENT")
Dim blVal3:blVal3 = (UCase(className) = "VIEWLINK")
Dim blVal4:blVal4 = (UCase(className) = "WEBTABLE")
If blVal1 Or blVal2 Or blVal3 Or blVal4 Then
specifiedAtt = "innertext"
Elseif Ucase(objectClass) = "WINDOW" Then
specifiedAtt = "text"
Elseif Ucase(objectClass) = "BROWSER" Or Ucase(objectClass) = "PAGE" Then
specifiedAtt = "title"
Else
specifiedAtt = "name"
End If
If GenerateSpecifiedObject (objectClass, specifiedText, brNumber, ifModule).Exist(0) Then
objValue = GenerateSpecifiedObject (objectClass, specifiedText, brNumber, ifModule).GetROProperty(specifiedAtt)
Report micDone, objectClass & "匹配对象成功", "对象【" & objectClass & "】【" & objValue & "】查询成功! "
boolValue = True
Else
Report micWarning, objectClass & "匹配对象失败", "对象【" & objectClass & "】根据关键字【 " & specifiedText & " 】查询无果!"
boolValue = False
End If
Set MyObject = Nothing
FindSpecifiedObject = boolValue
End Function
‘***************************************************************************************************************************************
'设计说明:点击网页上可以点击的对象,包括链接、按钮、图标、虚拟链接、文件上传域、网页不识别组件
'程序输入:1.对象的类明,2.指定的属性值关键字(可模糊匹配),3.页面层次序号,4.是否模态窗口
'程序输出:描述性语言字符串
'设计人员:LIUYI027
'设计时间:2011-01-11
'调用举例:ClickSpecifiedObject "Link","退出系统",2,"N"
‘***************************************************************************************************************************************
Public Function ClickSpecifiedObject (objectClass, specifiedText, brNumber, ifModule)
Dim boolValue:boolValue = False
Dim isDisabled:isDisabled = ""
Dim isReadonly:isReadonly = ""
Dim blVal1:blVal1 = (UCase(objectClass) <> "LINK")
Dim blVal2:blVal2 = (UCase(objectClass) <> "WEBBUTTON")
Dim blVal3:blVal3 = (UCase(objectClass) <> "IMAGE")
Dim blVal4:blVal4 = (UCase(objectClass) <> "VIEWLINK")
Dim blVal5:blVal5 = (UCase(objectClass) <> "WEBFILE")
Dim blVal6:blVal6 = (UCase(objectClass) <> "WEBELEMENT")
If blVal1 And blVal2 And blVal3 And blVal4 And blVal5 And blVal6 Then
Report MicFail,"ClickSpecifiedObject 函数参数错误","ClickSpecifiedObject 函数只适用于LINK、WEBBUTTON、IMAGE、VIEWLINK、
WEBFILE、WEBELEMENT,请确认!"
Exit Function
End If
If Not GenerateSpecifiedObject (objectClass, specifiedText, brNumber, ifModule).Exist(0) Then
Report micFail, "ClickSpecifiedObject 操作失败", "网页对象【" & objectClass & "】按照关键字【" & specifiedText & "】没有查询到!"
boolValue = False
Else
isDisabled = GenerateSpecifiedObject (objectClass, specifiedText, brNumber, ifModule).GetROProperty("disabled")
isReadonly = GenerateSpecifiedObject (objectClass, specifiedText, brNumber, ifModule).GetROProperty("readonly")
If Trim(isDisabled) = "1" Or Trim(isReadonly) = "1" Then
Report micFail, "ClickSpecifiedObject 操作失败", "网页对象【" & objectClass & "】【" & specifiedText & "】Disabled!"
boolValue = False
Else
GenerateSpecifiedObject (objectClass, specifiedText, brNumber, ifModule).Click
Report micDone, "函数ClickSpecifiedObject 操作点击完成:","网页对象【" & objectClass & "】:【" & specifiedText & "】点击完
毕,并且已经执行网页初始化!"
boolValue = True
SyncronizeBrowser
End If
End If
SyncronizeBrowser
ClickSpecifiedObject = boolValue
End Function
‘***************************************************************************************************************************************
'设计说明:向输入框中输入指定的文本
'程序输入:1.Edit 对象name 的属性值,2.指定的属性值,3.页面层次序号,4.是否模态窗口
'程序输出:描述性语言字符串
'设计人员:LIUYI027
'设计时间:2011-01-11
'调用举例:PutValueToEditableArea "WebEdit","projectWorkTimes.*remark","日报明细",1,"N"
‘***************************************************************************************************************************************
Public Function PutValueToEditableArea (objectClass, nameValue, specifiedText, brNumber, ifModule)
Dim isDisabled:isDisabled = ""
Dim isReadonly:isReadonly = ""
Dim boolValue:boolValue = False
If Ucase(objectClass) <> "WEBCHECKBOX" And Ucase(objectClass) <> "WEBFILE" And Ucase(objectClass) <> "WEBEDIT"
Then
Report MicFail,"PutValueToEditableArea 函数参数错误","该函数只适用于WebFile、WebEdit 和WebCheckBox,请确认!"
PutValueToEditableArea = boolValue
Exit Function
Elseif Ucase(objectClass) = "WEBCHECKBOX" And (Ucase(specifiedText) <> "ON" Or Ucase(specifiedText) <> "OFF") Then
Report MicFail,"PutValueToEditableArea 函数参数错误","WebCheckBox 属性值只能用ON 或OFF,请确认!"
PutValueToEditableArea = boolValue
Exit Function
Elseif Ucase(objectClass) = "WEBCHECKBOX" And (Ucase(specifiedText) = "ON" Or Ucase(specifiedText) = "OFF") Then
specifiedText = Ucase(specifiedText)
Else
specifiedText = specifiedText
End If
If Not GenerateSpecifiedObject (objectClass, nameValue, brNumber, ifModule).Exist(0) Then
Report micFail, "PutValueToEditableArea 操作失败", "网页对象【" & objectClass & "】按照关键字【"&nameValue&"】没有查询到!"
PutValueToEditableArea = boolValue
Exit Function
End If
isDisabled = GenerateSpecifiedObject (objectClass, nameValue, brNumber, ifModule).GetROProperty("disabled")
isReadonly = GenerateSpecifiedObject (objectClass, nameValue, brNumber, ifModule).GetROProperty("readonly")
nameValue = GenerateSpecifiedObject (objectClass, nameValue, brNumber, ifModule).GetROProperty("name")
If Trim(isReadonly) = "1" Or Trim(isDisabled) = "1" Then
Report micFail, "PutValueToEditableArea 操作失败", "输入框/文件浏览框/复选框【" & nameValue & "】已经查询到但是不可编辑!"
boolValue = False
Else
GenerateSpecifiedObject (objectClass, nameValue, brNumber, ifModule).Set specifiedText
SyncronizeBrowser
Report micDone, "PutValueToEditableArea 操作成功", "文本【" & specifiedText & "】成功输入或设置可编辑域【" & nameValue & "】!"
boolValue = True
End If
PutValueToEditableArea = boolValue
End Function
‘***************************************************************************************************************************************
'设计说明:从指定的WebList 下拉列表中选择指定项(Trim 掉空格,不可模糊匹配)
'程序输入:1.WebList 对象name 的属性值,2.指定的选择项,3.页面层次序号,4.是否模态窗口
'程序输出:描述性语言字符串
'设计人员:LIUYI027
'设计时间:2011-01-11
'调用举例:SelectFromWebList "projectWorkTimes.*remark","平安科技",1,"N"
‘***************************************************************************************************************************************
Public Function SelectFromWebList (listName, text, brNumber, ifModule)
Dim localDesc:localDesc = ""
Dim canSelect:canSelect = False
Dim boolValue:boolValue = False
localDesc = GenerateDescription(brNumber, ifModule) & GenerateObjectDescription("WebList", "name:=.*" & listName & ".*")
Execute "Set MyWebList = " & localDesc
If Not MyWebList.Exist(0) Then
Report micFail, "SelectFromWebList", "网页下拉列表(WebList)【" & listName & "】按照关键字【" & text & "】没有查询到!"
SelectFromWebList = boolValue
Exit Function
End If
iCount = MyWebList.GetROProperty("items count")
canMod1 = MyWebList.GetROProperty("disabled")
For i = 1 to iCount
itemValue = MyWebList.GetItem(i)
If Trim(itemValue) = Trim(text) And canMod1 = "0" Then
canSelect = True
Exit For
End If
Next
If canSelect Then
MyWebList.Select itemValue
SyncronizeBrowser
Report micDone, "下拉列表选择成功", "选择项【" & itemValue & "】已经被查询到、选择,并且执行初始化!"
boolValue = True
Else
Report micFail, "下拉列表选择失败", "下拉列表【" & listName & "】不可编辑!"
boolValue = False
End If
SelectFromWebList = boolValue
End Function
‘***************************************************************************************************************************************
'设计说明:按照给定的值选择网页单选框WebRadioGroup
'程序输入:1.WebRadioGroup 对象name 的属性值,2.指定的选择项,3.页面层次序号,4.是否模态窗口
'程序输出:描述性语言字符串
'设计人员:LIUYI027
'设计时间:2011-01-11
'调用举例:SelectWebRadioGroup "remark","a",1,"N"
‘***************************************************************************************************************************************
Public Function SelectWebRadioGroup (radioName, attValue, brNumber, ifModule)
Dim localDesc:localDesc = ""
Dim canSelect:canSelect = False
Dim boolValue:boolValue = False
Dim isDisabled:isDisabled = ""
localDesc = GenerateDescription(brNumber, ifModule) & GenerateObjectDescription("WebRadioGroup", "name:=.*" & radioName & ".*")
Execute "Set MyRadioGroup = " & localDesc
If Not MyRadioGroup.Exist(0) Then
Report micFail, "WEB 单选框查询失败", "单选框【" & radioName & "】按照关键字【" & attValue & "】没有查询到!"
Exit Function
Else
isDisabled = MyRadioGroup.GetROProperty("disabled")
End If
If Trim(isDisabled) = "0" Then
MyRadioGroup.Select attValue
Report micDone, "WEB 单选框选择成功", "选择项【" & attValue & "】已经被查询到、选择,并且执行初始化!"
boolValue = True
Else
Report micFail, "WEB 单选框选择失败", "单选框【" & radioName & "】不可选择编辑!"
boolValue = False
End If
SyncronizeBrowser
SelectWebRadioGroup = boolValue
End Function
‘***************************************************************************************************************************************
'设计说明:指定在某个Frame 下面工作,如果不需要使用则使用另一个函数停止操作
'程序输入:1.Frame 对象属性名,2.指定的属性值
'程序输出:描述性语言字符串
'设计人员:LIUYI027
'设计时间:2011-01-11
'调用举例:WorkUnderFrame ("name","frameContent")
‘***************************************************************************************************************************************
Public Sub WorkUnderFrame(frameAtt,frameKey)
Dim frameDesc :frameDesc = ""
frameIdentify = frameAtt & ":=.*" & frameKey & ".*"
frameDesc = "Frame(" & Quote("micclass:=Frame") & "," & Quote(frameIdentify) & "," & Quote("index:=0") & ")."
End Sub
‘***************************************************************************************************************************************
'设计说明:将对象运行层次调到Page 下,而不在任何Frame 下
'程序输入:
'程序输出:将Frame 的描述性语言清空
'设计人员:LIUYI027
'设计时间:2011-01-11
'调用举例:StopWorkUnderFrame
‘***************************************************************************************************************************************
Public Sub StopWorkUnderFrame()
frameDesc = ""
End Sub
‘***************************************************************************************************************************************
'设计说明:将字符串两端加上双引号,引自SAFFRON 框架
'程序输入:字符串
'程序输出:加了引号的字符串
'设计人员:
'设计时间:2011-01-11
'调用举例:Quote("AAA")返回 "AAA"
‘***************************************************************************************************************************************
Public Function Quote (text)
Quote = Chr(34) & text & Chr(34)
End Function
‘***************************************************************************************************************************************
'设计说明:简化ReportEvent 的书写,引自SAFFRON 框架
'程序输入:结果报告状态
'程序输出:结果报告
'设计人员:
'设计时间:2011-01-11
'调用举例:Report MicPass
‘***************************************************************************************************************************************
Public Function Report (status, objtype, text)
Reporter.Filter = rtEnableAll
Reporter.ReportEvent status, objtype, text
End Function
‘***************************************************************************************************************************************
'设计说明:取字符或字符串在一个数组中的位置,引自SAFFRON 框架
'程序输入:数组、字符串
'程序输出:位置序号
'设计人员:
'设计时间:2011-01-11
'调用举例:IndexOf(myArray,"something")
‘***************************************************************************************************************************************
Public Function IndexOf (myArray, myString)
myValue = -1
For i = 0 to UBound(myArray)
If myArray(i) = myString Then
myValue = i
Exit For
End If
Next
IndexOf = myValue
End Function