|
我在QTP里的代码是:
ExecuteFile "f:\xx\temp.vbs"
Call a()
我的temp.vbs的代码是:
Public Function a()
dim WshShell
dim s
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.run "cmd"
WshShell.AppActivate"c:\windows\system32\cmd.exe"
WScript.Sleep 200
WshShell.SendKeys"ftp localhost"
WshShell.SendKeys"{ENTER}"
WshShell.AppActivate"ftp.exe "
WshShell.SendKeys"toptea"
WshShell.SendKeys"{ENTER}"
WshShell.SendKeys"toptea"
WshShell.SendKeys"{ENTER}"
'读文件
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile("D:\QTP\Tests\ChinaMobileBOMC\put.txt", 1)
s = ts.ReadLine
ts.Close
'在远程生成文件夹并改变远程目录到新建文件夹下
WshShell.SendKeys"mkdir "+s
WshShell.SendKeys"{ENTER}"
WshShell.SendKeys"cd "+s
WshShell.SendKeys"{ENTER}"
WshShell.SendKeys"put D:\QTP\Tests\ChinaMobileBOMC\"+s+"\Report\Results.xml" '上传本地文件到远程
WshShell.SendKeys"{ENTER}"
WshShell.SendKeys"bye"
WshShell.SendKeys"{ENTER}"
End function
现在一运行就报缺少wscript对象错误.我的脚本双击执行是可以的,请问我这个问题出在什么地方啊?应该怎么解决啊?谢谢了. |
|