在SecureCRT屏幕上获取数据并存至文件中
来源:互联网 发布:帝国cms首页模板修改 编辑:程序博客网 时间:2024/06/05 14:21
在CRT屏幕上获取某个具体位置的文本.
可以使用Screen 对象的Get() or Get2()方法去获取屏幕上的数据.
1 Get() 函数包含四个参数.文本第一个字符所在的行号,列号.最后个字符所在的行号与列号.
可以通过选择相应的文本来查看文字所处的行号与列号.
以下就可获取相应的值.
nFreeMem = crt.Screen.Get (5,36,5,41)
把数据写放到文本中
Writing data to a file using the VBScript FileSystemObject can typically be accomplished using
the following general steps:
1) Get a reference to the FileSystemObject :
Set objFSO = CreateObject( "Scripting.FileSystemObject" )
2) Use the FileSystemObject reference to retrieve a reference to a TextStream object
associated with the text file to which the data is to be written.
Const ForWriting = 2
Const ForAppending = 8
' Create a new file (or overwrite an existing one)
Set objStream = objFSO.OpenTextFile( _
"C:\Temp\MyDataFile.txt", _
ForWriting, _
True)
' Append to an existing file (create if it doesn't exist)
Set objStream = objFSO.OpenTextFile( _
"C:\Temp\MyDataFile.txt", _
ForAppending , _
True)
3) Write the data to the file using the TextStream object's Write or WriteLine methods.
The WriteLine method automatically appends EOL characters to the end of the data
supplied to the method.
objStream.Write "This data is written "
objStream.Write "as one single line."
Or:
objStream.WriteLine "This data is written "
objStream.WriteLine "as two separate lines."
Note that you can write multiple lines using either method by manually inserting CRLF
sequences as needed, for example:
bjStream.Write "This is line one." & vbcrlf & _
"This is line two." & vbcrlf & _
"This is line three." & vbcrlf & _
"This is line four." & vbcrlf
Or:
objStream.WriteLine "This is line one." & vbcrlf & _
"This is line two." & vbcrlf & _
"This is line three." & vbcrlf & _
"This is line four."
4) When you have completed writing data to the file, close the file:
objStream.Close
EXAMPLE:获取CPU数据并将其写入到文件中
# $language = "VBScript"
# $interface = "1.0"
Sub Main ()
For x = 1 To 10000
crt.sleep 300000
usrCpu = crt.Screen.Get(2,7,2,9)
sysCpu = crt.Screen.Get (2,15,2,18)
idleCpu =crt.Screen.get(2,35,2,37)
Dim fso, f1
Set fso = CreateObject("Scripting.FileSystemObject")
Set f1 = fso.OpenTextFile("E:\TestFile.txt", 8,True)
f1.writeline("usr:" & usrCpu & " sysCpu:" & sysCpu & " idleCpu" & idleCpu)
f1.close
Next
end Sub
- 在SecureCRT屏幕上获取数据并存至文件中
- Dialog和软键盘在屏幕上的并存问题:
- 获取浏览器地址栏get请求的数据并存在一个对象中
- java获取excel中数据并存入数据库表中
- requests从api中获取数据并存放到mysql中
- requests从api中获取数据并存放到mysql中
- secureCRT设置vim关闭后不显示在屏幕上
- 从键盘输入两个学生数据,写入一个文件中, 再读出这两个学生的数据显示在屏幕上。
- js获取当前时间并存到数据中
- Android 用Retrofit进行网络获取数据,recyclerview进行展示在Fragment里,并存入到GreenDao数据库中
- 获取屏幕位置、高度和在屏幕上的位置
- CvMat数据在屏幕上打印
- Android 数据显示在屏幕上
- PB在计算列中获取上一行数据
- Android学习之路------代码中获取Logcat打印日志并存放于文件中
- Android学习之路------代码中获取Logcat打印日志并存放于文件中
- c语言把文件中数据读取并存到数组中
- Shop项目--3. 使用ajax获取商品分类列表,并存在redis中
- javascript正则函数match、exec、test、search、replace、split 实例大比拼
- 让cacti监控路由器与交换机的流量
- metro button 自定义不同状态下的字体颜色
- Tomcat 的session管理
- 关于SLL与DLL
- 在SecureCRT屏幕上获取数据并存至文件中
- XMPP/Smack/Openfire javax.net.ssl.SSLException: Received fatal alert: internal_error
- ubuntu环境下安装字体
- 被点击访问过的超链接样式不在具有hover和active了
- UISegmentedControl详解
- vc2005调试
- Linux 文件共享 NFS
- 【工具教程】NotePad++教程
- 【web前端】小tip: 外链地址网站标志图标API应用