Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PCOMM 5.8: how do I tell when a print screen is complete?

74 views
Skip to first unread message

Graham Hannington

unread,
Sep 20, 2005, 10:12:27 AM9/20/05
to
Does anyone have a reliable method for testing when a print screen (to file)
is complete?

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


bwegge

unread,
Sep 21, 2005, 4:29:49 AM9/21/05
to
Hi Graham

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

0 new messages