求救:我被vbs搞懵了。
是这样的。我的要求其实很简单:通过vbs脚本打开指定路径的txt文件,然后全选里面的内容剪切到剪贴板,然后关闭此文件。
我写了一个老是出错,我不知道怎么回事。请教VBS高手。感激不尽
我写的
set ws=createobject("wscript.shell")
ws.Run "C:\StudyInfo\Study\VBS\ReadyData.txt"
ws.AppActivate "ReadyData.txt - Notepad"
'ws.Popup
ws.SendKeys "^A"
ws.SendKeys "^C"
ws.SendKeys "%{F4}"
[解决办法]
Set S=CreateObject("Scripting.FileSystemObject")Set F=S.OpenTextFile("D:\aaaa.txt")LL=F.ReadAllSet ie = CreateObject("internetexplorer.application") ie.navigate "about:blank" ie.document.parentwindow.clipboarddata.SetData "text", LLie.Quit
[解决办法]
set ws=createobject("wscript.shell") ws.Run "C:\StudyInfo\Study\VBS\ReadyData.txt" ws.AppActivate "ReadyData.txt - Notepad" 'ws.AppActivate "ReadyData.txt - 记事本" 中文版的话 WScript.Sleep 1000 '延时'ws.Popup ws.SendKeys "^a" WScript.Sleep 200ws.SendKeys "^c" WScript.Sleep 200ws.SendKeys "%{F4}"