|
我今天研究了一下计算器使用DataPool的例子 ,使用键盘输入数据并用DataPool的数据代替能运行成功;我改为鼠标点击输入计算数据,用DataPool数据代替自动输入就不能运行。我不知道还要修改什么~?
代码如下:
'$Include "sqautil.sbh"
Sub Main
Dim Result As Integer
'
dim dp as long
dim x as integer
dim num1 as string
dim num2 as string
dim sum as string
'Initially Recorded: 2007-11-23 11:37:12
'Script Name: 计算器
StartApplication "C:\WINDOWS\system32\calc.exe"
'
dp=SQADatapoolOpen("jsp")
for x=1 to 5
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不能自动输入
Window SetContext, "Caption=计算器", ""
PushButton Click, "Text=num1"
PushButton Click, "Text=+"
PushButton Click, "Text=num2"
PushButton Click, "Text=="
'
msgbox num1
msgbox num2
msgbox sum
Result = EditBoxVP (CompareNumeric, "ObjectIndex=1", "VP=Alphanumeric;Value="& sum &".")
next
Call SQADatapoolClose(dp)
Window CloseWin, "", ""
End Sub
[ 本帖最后由 mastertester 于 2007-11-23 11:55 编辑 ] |
|