关于VBS读取TXT文本问题
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于VBS读取TXT文本问题相关的知识,希望对你有一定的参考价值。
我弄了很多个QQ自动登际批处理,但是在不同网吧QQ地址不同,因为很多QQ,所以一个一个改太麻烦了,想利用都读取一个叫1.txt文件来读取地址,然后打开QQ,不知道怎么设置,有看过READALL命令,但还是不会用,所以请高手帮我做一个。我这VBS文件现在是:
Dim WshShell,QQPath,QQselect
QQPath="E:\聊天工具\QQ2010\Bin\QQ.exe"
Set WshShell=WScript.CreateObject("WScript.Shell")
WshShell.Run QQPath
WScript.Sleep 500
WshShell.SendKeys"+TAB"
WshShell.SendKeys "290134538"
WScript.Sleep 200
WshShell.SendKeys"TAB"
WshShell.SendKeys "ssynkfhv"
WScript.Sleep 200
WshShell.SendKeys"ENTER"
补充,读txt的:
Dim WshShell,QQPath,QQselect
QQPath = "1.txt"
Set objFso = WScript.CreateObject("Scripting.FileSystemObject")
Set objFile = objFso.OpenTextFile(QQPath,1,False)
QQPath = objFile.ReadAll
Set WshShell=WScript.CreateObject("WScript.Shell")
WshShell.Run QQPath
WScript.Sleep 500
WshShell.SendKeys"+TAB"
WshShell.SendKeys "290134538"
WScript.Sleep 200
WshShell.SendKeys"TAB"
WshShell.SendKeys "ssynkfhv"
WScript.Sleep 200
WshShell.SendKeys"ENTER"
读注册表来自动获取QQ安装路径,不需要txt文件这么麻烦
Dim WshShell,QQPath,QQselect
Dim key,index,result
Set WshShell=WScript.CreateObject("WScript.Shell")
key=Shell.RegRead("HKEY_CLASSES_ROOT\CLSID\4F7C9975-ECA1-4190-B0EB-E37BC5E40893\LocalServer32\")
index=InStr(key,"Bin")-2
result=Left(key,index)
result=Mid(result,2)
QQPath=result+"\Bin\QQ.exe"
WshShell.Run QQPath
WScript.Sleep 500
WshShell.SendKeys"+TAB"
WshShell.SendKeys "290134538"
WScript.Sleep 200
WshShell.SendKeys"TAB"
WshShell.SendKeys "ssynkfhv"
WScript.Sleep 200
WshShell.SendKeys"ENTER" 参考技术A 伙计,你把QQ号和密码打一下马赛克啊,我刚刚试试看,居然你这么老实,登录上去了~~~~~
以上是关于关于VBS读取TXT文本问题的主要内容,如果未能解决你的问题,请参考以下文章