Dim foodmenudesc,foodmenudescexit
Set foodmenudescexit=description.Create
foodmenudescexit("name").value="Edit"
foodmenudescexit("text").value="Edit"
foodmenudescexit("outerhtml").value="<A onclick='setUpdateFoodMenu.*"
Set foodmenudesc=Browser("name:=Wpos system F023","title:=Wpos system F015").Page("title:=Wpos system F023").Frame("name:=content").ChildObjects(foodmenudescexit)
i=foodmenudesc.count
foodmenudesc(Randomnuber(0,(i-1)).click .’随机取点击一个link |
‘激活窗口
Window(“Flight Reservation”).Activate
‘选择菜单
Window(“Flight Reservation”).WinMenu(“Menu”).select “File;Fax Order….”
‘运行名为 “Track1”的Analog脚本
Desktop.RunAnlog “Track1” |
Sub BlockInput_Example()
SystemUtil.BlockInput ‘禁用输入
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").Set
"mercury"
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury
Tours").WebEdit("password").SetSecure "4082986e39ea469e70dbf8c5a29429fe138c6efc"
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").Image("Sign-In").Click 2,
2
SystemUtil.UnblockInput ‘释放输入
End Sub |
在本例中:假定在运行程序之初,Record and Run 对话框自动打开了某个窗口,然后通过 Run语句打开了一个 NotePad 窗口,
那么该 CloseDscendentProcessed方法的返回值就就该是 2,因此 Message对话框显示的信息应该是”2“。
Sub CloseDescendentProcesses_Example()
SystemUtil.Run "Notepad.exe"
MsgBox SystemUtil.CloseDescendentProcesses
End Sub |
在本例中,首先通过 GetroProperty 方法获取 NotePad 窗口的句柄,然后使用CloseProcessByHwnd 方法关闭 Notepad 程
序。
Sub CloseProcessByHwnd_Example()
hWnd = Window("Notepad").GetROProperty("hwnd")
SystemUtil.CloseProcessByHwnd (hWnd)
End Sub |
实例:
下面的例子通过 GetRoProperty 方法获取 Notepad 窗口的PID 值,然后使用CloseProcessById方法关闭 Notepad 程序。
Sub CloseProcessById_Example()
PID = Window("Notepad").GetROProperty("process id")
SystemUtil.CloseProcessById (PID)
End Sub |
pwd = "123"
e_pwd = Crypt.Encrypt(pwd)
‘e_pwd就是加密以后的密码了.
|
Example:
Set XMLObj = XMLUtil.CreateXMLFromFile("C:\XML\BookStore.xml") |
Set excelObj = createobject("Excel.Application") '创建一个excel对象
excelObj.workbooks.open("C:\test.xls")
Set sheetNew = excelobj.sheets.item(1)'' 设置将数据放在 EXCEL 中的那一页上 ( 索引从1开始 )
Const strconn = "Provider=sqloledb;Server=192.168.11.116;Database=WPOSPlatformProduct;Uid=sa;Pwd=0"
Set conn=createobject("Adodb.Connection")
Set res=createobject("Adodb.recordset")
sql2000 = "SELECT * FROM t_CakeFilling"
conn.open strconn
'res.Open sql, conn
res.Open sql2000, conn 'sql2000为查询语句
res.MoveFirst()
Dim i
Dim j
j=1
Do while not res.eof
For i=0 to res.Fields.count-1
sheetNew.cells(j,(i+1)).value=res.fields(i).value
Next
j=j+1
res.movenext()
Loop
res.close
conn.close
Set res=nothing
Set conn=nothing
excelObj.activeworkbook.saveas "C:\data.xls" ' 保存数据
excelObj.quit ' 关闭对象
set excelObj = nothing ' 清空对象 |
Function writeorderno()
Dim fso, myfile,username,passwd
set fso=CreateObject("scripting.FileSystemObject")
set myfile=fso.openTextFile("C:\test.txt",1,false)
p=split(myfile.readline,",")
msgbox p(0)
msgbox p(1)
myfile.close
end Function |
writeorderno("我是张玉")
Function writeorderno(orderno)
Dim fso, myfile
Set fso=CreateObject("scripting.FileSystemObject")
Set myfile=fso.openTextFile("C:\test.txt",8,false)
myfile.writeline orderno
myfile.close
End Function |
browser("Untitled Page").Page("Untitled Page").webelement("html id:=div1").link("index:=1").Click |