vbs 批处理问题 目的是想自动打开一个文本,脚本暂停,在文本中输入数据并关闭后,脚本继续,
请高手看看下面的脚本.问题在现在并不是监控文本关闭后脚本继续,而是WScript.Sleep5000在起作用.求指导........setfso=createobject...
请高手看看下面的脚本.问题在 现在并不是监控文本关闭后脚本继续,而是WScript.Sleep 5000在起作用. 求指导........
set fso=createobject("scripting.filesystemobject")
set ws=createobject("wscript.shell")
p=replace(wscript.scriptfullname,wscript.scriptname,"")
set txt=fso.opentextfile(p&"NewTxt.txt",2,true) '新建一个文本文档
txt.close
ws.run p&"NewTxt.txt"
WScript.Sleep 5000
On Error Resume Next
count = 0
set WshShell = WScript.CreateObject("WScript.Shell")
Do While count < 10
if Wshshell.appactivate ("NewTxt.txt")=true then
WScript.Sleep 1000
count = count + 1
Else
Dim objfs
Dim s
Set objfs=CreateObject("scripting.filesystemobject")
Set objf=objfs.OpenTextFile("NewTxt.txt",1,False)
s=objf.Readall
objf.Close
set objf=nothing
set objfs=nothing
fso = CreateObject ("Scripting.FileSystemObject")
Set logFile = fso.OpenTextFile("序列.seq",2,True)
logFile.WriteLine(s)
logFile.Closese
End If
Exit Do
Loop
WScript.Sleep 2000
set fso=createobject("scripting.filesystemobject")
on error resume next
set sfile=fso.getfile("NewTxt.txt")
sfile.attributes=0
sfile.delete 展开
set fso=createobject("scripting.filesystemobject")
set ws=createobject("wscript.shell")
p=replace(wscript.scriptfullname,wscript.scriptname,"")
set txt=fso.opentextfile(p&"NewTxt.txt",2,true) '新建一个文本文档
txt.close
ws.run p&"NewTxt.txt"
WScript.Sleep 5000
On Error Resume Next
count = 0
set WshShell = WScript.CreateObject("WScript.Shell")
Do While count < 10
if Wshshell.appactivate ("NewTxt.txt")=true then
WScript.Sleep 1000
count = count + 1
Else
Dim objfs
Dim s
Set objfs=CreateObject("scripting.filesystemobject")
Set objf=objfs.OpenTextFile("NewTxt.txt",1,False)
s=objf.Readall
objf.Close
set objf=nothing
set objfs=nothing
fso = CreateObject ("Scripting.FileSystemObject")
Set logFile = fso.OpenTextFile("序列.seq",2,True)
logFile.WriteLine(s)
logFile.Closese
End If
Exit Do
Loop
WScript.Sleep 2000
set fso=createobject("scripting.filesystemobject")
on error resume next
set sfile=fso.getfile("NewTxt.txt")
sfile.attributes=0
sfile.delete 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询