Here's my current HACL'n'VBScript:
' Send a "print" key
autECLPSObj.SendKeys "[printps]"
' Use various kludges to wait until print screen file has been written
Do Until autECLOIAObj.WaitForAppAvailable(20000)
Loop
Do Until autECLOIAObj.WaitForInputReady(20000)
Loop
' Repeatedly read print screen file until it is complete
strScreen = ""
Do
If fso.FileExists(strScreenFilePath) Then
Set file = fso.OpenTextFile(strScreenFilePath, conForReading, True)
If Not(file.AtEndOfStream) Then
strScreen = file.ReadAll
End If
file.Close
Set file = Nothing
End If
Loop Until InStr(strScreen, "[text on last line of printed screen]")
Yeah, I know: repeatedly reading the file until a telltale final line is
detected? Somebody take pity on me... :-)
(Neither could I figure out how to invoke "print screen" without SendKeys.)
Regards,
Graham Hannington
graham (underscore) hannington (at) fundi (dot) com (dot) au
The short answer is: no, I don't.
I do know of a way to get the contents of pcomm screen and putting it
into a file, which seems to be what you are trying to do.
-- scr2file.mac
[PCOMM SCRIPT HEADER]
LANGUAGE=VBSCRIPT
DESCRIPTION=
[PCOMM SCRIPT SOURCE]
OPTION EXPLICIT
autECLSession.SetConnectionByName(ThisSessionName)
REM This line calls the macro subroutine
subSub1_
sub subSub1_()
Dim s
Dim i
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
'Read Screen
s = ""
i = 1
while (i < autECLSession.autECLPS.NumRows)
s = s + autECLSession.autECLPS.getText(i, 1,
autECLSession.autECLPS.NumCols)
s = s + vbNewline
i = i + 1
Wend
'Dump to file
dim filename
filename = InputBox("Enter filename", "Save screen", "C:\test.txt")
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.CreateTextFile(filename, True)
f.Write s
f.Close
end sub
--
You could use GetTextRect to make it faster. I didn't care as it really
doesn't matter if it is 10% faster...
Regards
bwegge