我正在尝试在VBS上制作一个脚本,但我似乎并不擅长它,想知道你是否可以提供帮助。我有一个文本文件和21行字符45,46由一个数字组成(假设这个数字是19)。我希望脚本查看该数字,如果超过30则执行.bat文件。如果没有那么什么都不做。我很感激帮助!
另一个人帮了我,我现在得到了这个代码
Public Sub FindCode()
tempLines = ReadFileLines("TempOutput.txt")
If tempLines Is Nothing Then
MessageBox.Show("file not read")
Return
End If
If tempLines.Count < 21 Then
MessageBox.Show("Line 21 does not exist")
Return
End If
'position of line is one less than we are lookign for since List(Of T) is zero based
position = 21 - 1
If tempLines(position).Length < 46 Then
MessageBox.Show("Line 22 does not have 46 characters")
Return
End If
If IsNumeric(tempLines(position).Substring(44, 2)) = False Then
'characters 45 and 46 (zero based (44) for 2 characters)
MessageBox.Show("characters 45-46 are not numeric")
End If
If CInt(tempLines(position).Substring(44, 2)) <= 18 Then
MessageBox.Show("characters 45-46 are less than or equal to 18")
Return
End If
System.Diagnostics.Process.Start("batchfile.bat")
End Sub
我认为这是针对VB而不是VBS