Text 我需要使用wscript将数据保存到文本文件中

Text 我需要使用wscript将数据保存到文本文件中,text,vbscript,writing,Text,Vbscript,Writing,我正在制作一个脚本,可以让你登录到你的Facebook帐户,而不必进入互联网并亲自输入。我想添加一个选项来保存您的登录信息。我需要能够将数据写入文件,并将数据放回变量中。以下是我到目前为止的情况: On Error Resume Next set ie = CreateObject("InternetExplorer.Application") sub loading do while ie.busy wscript.sleep 350 loop end sub username=inputbo

我正在制作一个脚本,可以让你登录到你的Facebook帐户,而不必进入互联网并亲自输入。我想添加一个选项来保存您的登录信息。我需要能够将数据写入文件,并将数据放回变量中。以下是我到目前为止的情况:

On Error Resume Next
set ie = CreateObject("InternetExplorer.Application")
sub loading
do while ie.busy
wscript.sleep 350
loop
end sub
username=inputbox("Please Enter Your Facebook Username/Email:","Facebook LogIn")
password=inputbox("Please Enter Your Facebook Password:","Facebook LogIn")
ie.left=0
ie.top=0
ie.toolbar=0
ie.statusbar=0
ie.height=135
ie.width=1020
ie.resizable=0
ie.navigate"https://www.facebook.com/"
call loading
ie.document.all.item("email").value=(username)
ie.document.all.item("pass").value=(password)
ie.Document.All.Item("login_form").Submit
call loading
ie.width=1200
ie.height=700
ie.resizable=true
ie.visible=true
请注意,这些代码不是我自己写的。我通过youtube获得了一些帮助,可以编辑html代码中的数据。

要写入文件:

Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
Dim file : Set file = fso.OpenTextFile("C:\temp\myfile.txt", 2, True)
file.Write "some text"
file.Close
要将文件内容读入变量,请执行以下操作:

Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
Dim file : Set file = fso.OpenTextFile("C:\temp\myfile.txt", 1, False)
myvar = file.ReadAll
file.Close

不用说,您将不得不修改它-您不一定要将整个文件内容读取到变量中。但这是最基本的。

这正是我需要的,非常感谢。