- 論壇徽章:
- 0
|
經(jīng)常要用到拷貝SESSION里的一些數(shù)據(jù),如果用拷貝粘貼會比較慢,而且是機(jī)械性的操作,一來累,二來容易出錯,于是想到了寫一個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
|
|