|
之前论坛中的数据池中的计算器例子根本就不可以用,而且错用验证点.
在此给出脚本...保证可用...供新手学习用....
''$Include "SQAUTIL.SBH"
这个脚本是window中的计算器做加法运算(num1+num2=sum).其中用到了数据池(自己建)和两个循环.比较好理解
Sub Main
Dim Result As Integer
dim xh as integer 'xh用来记录循环计算器的次数
dim x as integer 'x用来记录数据池使用的次数
dim num1 as string
dim num2 as string
dim sum as string
Dim dp as Long
'Initially Recorded: 2007-12-28 14:59:31
'Script Name: jsq
dp=SQADatapoolOpen("jsq")
For xh = 1 to 1
StartApplication "C:\WINDOWS\system32\calc.exe"
for x=1 to 9
Call SQADatapoolFetch(dp)
Call SQADatapoolValue(dp,1,num1)
Call SQADatapoolValue(dp,2,num2)
Call SQADatapoolValue(dp,3,sum)
Window SetContext, "Caption=计算器", ""
InputKeys num1 &"{+}"& num2 &"{ENTER}" 'num1+num2=sum
Result = EditBoxVP (CompareNumeric, "ObjectIndex=1", "VP=Alphanumeric;Value="& sum &"") '验证点
next x
Window CloseWin, "", ""
call SQADatapoolRewind(dp)
Next xh
Call SQADatapoolClose(dp)
End Sub |
|