- 论坛徽章:
- 0
|
经常要用到拷贝SESSION里的一些数据,如果用拷贝粘贴会比较慢,而且是机械性的操作,一来累,二来容易出错,于是想到了写一个VBSCRIPT来做这个事,代码附在后面,供参考。
[PCOMM SCRIPT HEADER]
LANGUAGE=VBSCRIPT
DESCRIPTION=
[PCOMM SCRIPT SOURCE]
OPTION EXPLICIT
autECLSession.SetConnectionByName(ThisSessionName)
REM This line calls the macro subroutine
Dim fso
Dim sPath
Dim sSystemDate
sSystemDate = Year(Date) & Right("00" & Month(Date), 2) & Right("00" & Day(Date), 2)
Set fso = CreateObject("Scripting.FileSystemObject")
sPath = "D:\DATA\" & Year(Date)
If Not fso.FolderExists(sPath) Then fso.CreateFolder sPath
sPath = sPath & "\" & Right("00" & Month(Date), 2)
If Not fso.FolderExists(sPath) Then fso.CreateFolder sPath
sPath = sPath & "\" & sSystemDate & "a.XLS"
If fso.FileExists(sPath) Then
If MsgBox(sPath & vbCrLf & vbCrLf & "File already exists !! Overwrite it ?", vbYesNo) = vbYes Then
fso.DeleteFile sPath
End If
End If
subCreateTextFile
sub subCreateTextFile()
Dim ts
Dim s
Dim i
Set ts = fso.OpenTextFile(sPath, 8, True)
Do
For i = 11 to 20
s = autECLSession.autECLPS.GetText(i, 5, 75)
ts.WriteLine s
autECLSession.autECLPS.Wait 100
Next
autECLSession.autECLPS.Wait 100
autECLSession.autECLPS.SendKeys "[roll up]"
autECLSession.autECLPS.Wait 100
Loop Until autECLSession.autECLPS.GetText(24, 2, 26) = "Already at bottom of area."
ts.Close
end sub
|
|