我是 vbs 新手,有一个问题。我有一个 js 变量文件,上面写着 var varname = "variable"; 在每一行。我想在 vbs 的引号内创建一个数组。我不知道如何使这项工作。
' Sample vbs
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("path", ForReading)
Const ForReading = 1
Dim arrFileLines()
i = 0
Do Until objFile.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objFile.ReadLine
i = i + 1
Loop
objFile.Close
'Then you can iterate it like this
For Each strLine in arrFileLines
leftquote = InStr(strLine,"""")
rightquote = InStrRev(strLine,"""")
str=CStr(strLine)
leng = rightquote-leftquote
WScript.Echo Mid(str,leftquote+1,leng)
Next
这是js
// Sample js
var a = new Array();
a[0] = "1";
a[1] = "2";
a[2] = "3";
a[3] = "4";