|
脚本意思就是:我想要把参数话的东西放到外部excel表中,然后从外部调该excel文件,并且把不同功能的模块做成一个function 然后运行该项目
//调用外部文件
Dim fso,filePath,l,a
Dim ExcelBook,ExcelSheel,myExcelBook,myExcelSheet1,myExcelSheet2,myExcelSheet3
filePath="E:/case3.xls"
Set fso = CreateObject ("Scripting.FileSystemObject")
Set ExcelBook = CreateObject("Excel.Application")
Set ExcelSheel = CreateObject("Excel.Sheet")
Set myExcelBook = ExcelBook.Workbooks.Open(filePath)
Set myExcelSheet1 = myExcelBook.Worksheets("sheet1")
Set myExcelSheet2 = myExcelBook.Worksheets("sheet2")
Set myExcelSheet3= myExcelBook.Worksheets("sheet3")
//送礼物函数
Function SendGift(sendMail,sendMsg,sendNickName)
Browser("咔咕,虚拟礼物,免费QQ头像,免费QQ秀,节日祝福,个性化,").Page("咔咕,虚拟礼物,免费QQ头像,免费QQ秀,节日祝福,个性化,").Link("立即赠送_2").Click
Browser("咔咕,虚拟礼物,免费QQ头像,免费QQ秀,节日祝福,个性化,").Page("咔咕,虚拟礼物,免费QQ头像,免费QQ秀,节日祝福,个性化,_6").WebEdit("email").Click
Browser("咔咕,虚拟礼物,免费QQ头像,免费QQ秀,节日祝福,个性化,").Page("咔咕,虚拟礼物,免费QQ头像,免费QQ秀,节日祝福,个性化,_3").WebEdit("email").Set sendMail
Browser("咔咕,虚拟礼物,免费QQ头像,免费QQ秀,节日祝福,个性化,").Page("咔咕,虚拟礼物,免费QQ头像,免费QQ秀,节日祝福,个性化,_3").WebEdit("message").Set sendMsg
Browser("咔咕,虚拟礼物,免费QQ头像,免费QQ秀,节日祝福,个性化,").Page("咔咕,虚拟礼物,免费QQ头像,免费QQ秀,节日祝福,个性化,_3").WebEdit("name").Set sendNickName
Browser("咔咕,虚拟礼物,免费QQ头像,免费QQ秀,节日祝福,个性化,").Page("咔咕,虚拟礼物,免费QQ头像,免费QQ秀,节日祝福,个性化,_3").Link("赠送").Click
'===================judge
Browser("咔咕,虚拟礼物,免费QQ头像,免费QQ秀,节日祝福,个性化,").Dialog("Windows Internet Explorer").WinButton("确定").Check CheckPoint("确定")
Browser("咔咕,虚拟礼物,免费QQ头像,免费QQ秀,节日祝福,个性化,").Dialog("Windows Internet Explorer").WinButton("确定").Click
Browser("咔咕,虚拟礼物,免费QQ头像,免费QQ秀,节日祝福,个性化,").Page("咔咕,虚拟礼物,免费QQ头像,免费QQ秀,节日祝福,个性化,_5").Link("重新选择礼物").Click
End Function
//调用 SendGift 函数给三个参数负值,从外部文件中取得
For i=1 to 3
Select Case i
Case 1: call SendGift( "myExcelSheet1.cells(i, 1).value ","myExcelSheet2.cells(i, 1).value ","myExcelSheet3.cells(i, 1).value")
Case 2: call SendGift( "myExcelSheet1.cells(i, 1).value ","myExcelSheet2.cells(i, 1).value ","myExcelSheet3.cells(i, 1).value")
Case 3: call SendGift( "myExcelSheet1.cells(i, 1).value ","myExcelSheet2.cells(i, 1).value ","myExcelSheet3.cells(i, 1).value")
End Select
Next |
|