We've used Passport for several years.  Here's a VBScript example for Passport 
that will allow you to specify the number of screens you want to copy and 
optionally the beginning and ending row on the screen.  After it copies each 
screen and appends it to a temporary file, it invokes my editor so that I can 
see the whole capture.

Comments start with a single quote.  At the end there is another way of doing 
this using VBScripts FileScriptingObject (FSO).  Passport had some issues with 
a 60x100 screen that way, so I stayed with the first version.  But maybe it 
matches PCOMM's functions better.  At least it shows how to work with FSOs.  

The macrouses Passport functions: 
GetScreenSize
AppendPSToFile
SendHostKeys
WaitForHostUpdate

And the VBScript functions: 
MsgBoxGetInput
Shell

I have the macro assigned to CTRL-S in my Passport keyboard so that I can just 
press Ctrl-S and be prompted for the number of pages, begin row & end row on 
each screen.  It saves the screen & pages down that number of times, then 
starts my editor with the results in the C:\temp file. 

- Wendell Lovewell

' ***********************************************************************
' This macro will page through a TRACK or XRAY storage display (D dataname or A 
address)
' and copy the number of pages you supply into a file named c:\temp\text.txt
' Assigned to Alt-D

Sub ZMain()
Dim Text, ret, nTimes, K, L, wrk, wrk2, wrk3
Dim strText
Dim nScreenSize, nRows, bRow, eRow, nCols

nScreenSize = GetScreenSize
If nScreenSize = 3564 Then nrows = 27
if nScreenSize = 3440 Then nrows = 43
if nScreenSize = 2560 Then nrows = 32
if nScreenSize = 1920 Then nrows = 24
if nScreenSize = 7200 Then nrows = 60

bRow = 7
eRow = nRows - 2
nCols = 80
If nScreenSize = 7200 Then ncols = 69

ret = Shell("c:\util\rm.bat C:\Temp\test.txt",6)    ' Call BAT file to delete 
previous version of the file

strText = "Screen Size = " & nScreenSize & " - " & nRows & " rows" & vbCRLF
strText = strText & "Enter the number of screens to copy, optionally with 
',bRow,eRow'"
nTimes = MsgBoxGetInput (strText)

K = InStr(nTimes,"*")
If K > 0 Then
   L = K - 1
   nTimes = Left(nTimes,L)
   bRow = 1
   eRow = Nrows
   End If

K = InStr(nTimes,",")
If K > 0 Then
   L = K - 1
   wrk2   = nTimes               'temp hold nTimes in wrk2
   nTimes = Left(nTimes,L)
   L = K + 1
   wrk = Mid(wrk2,L)             'wrk = part after nTimes,
   K = Instr(wrk,",")              'Is there a comma?
   If K > 0 Then
      L = K - 1
      bRow = Mid(wrk,l,1)
      l = k + 1
      wrk = Mid(wrk,l)             'wrk now = part after 2nd ","
      If Trim(wrk) > "" Then
         eRow = Trim(wrk)
      Else
         eRow = NRows
         End If
      End If
   End If

'*******************************************************
' Now, copy the data to the file via Passport's AppendPSToFile function
for k = 1 to nTimes
   Ret = AppendPSToFile("c:\temp\test.txt",bRow,2,eRow,ncols)
   SendHostKeys ("<PF8>")
   ret = WaitForHostUpdate(3)
   Next
'*******************************************************

If bRow = 7 Then
   ret = Shell("c:\util\x.bat C:\Temp\test.txt ( PROFILE CopyDumpToFPE",1)
Else
   ret = Shell("c:\util\x.bat C:\Temp\test.txt",1)
   End If

End Sub

' 
'******************************************************************************
' ' This is close to working, but also hung on the 60 x 100 screen size
' ' Needs crlf at end of each line
'
' Sub ZMainDidnotwork()
' Dim Text, ret, nTimes, k
' Dim strText, nRet
' Dim nCursorRow
' Dim nScreenSize, nRows, strCopyArea, EndRow, nBytes
'
' ' nCursorRow = GetCursorRow
' ' strText = "Current row position = " & nCursorRow
'
' ' nRet = MsgBox (strText, 0, "Row Position")
'
' nScreenSize = GetScreenSize
' If nScreenSize = 3564 Then nrows = 27
' if nScreenSize = 3440 Then nrows = 43
' if nScreenSize = 2560 Then nrows = 32
' if nScreenSize = 1920 Then nrows = 24
' if nScreenSize = 7200 Then nrows = 60
' EndRow = nRows - 2
'
' strText = "Screen Size = " & nScreenSize & " - " & nRows & " rows" & vbCRLF
' strText = strText & "Enter the number of screens to copy"
' nTimes = MsgBoxGetInput (strText)
'
' strCopyArea = ""
' nBytes = (Nrows - 6 - 2) * 80
'
' for k = 1 to nTimes
'    Ret = SelectArea(7,1,nRows,80)
'    strCopyArea = StrCopyArea & GetString (7,1,nBytes)
'
'    SendHostKeys ("<PF8>")
'    ret = WaitForHostUpdate(5)
'    Next
'
' strText = "The length of the data copied is " & Len(StrCopyArea)
' ret = MsgBox (strText,0,"Bytes Copied")
'
' ret = Shell("c:\util\rm.bat C:\Temp\CopyDump.txt",6)
' Call PutString (strCopyArea)
' ret = Shell("c:\util\x.bat  C:\Temp\CopyDump.txt",1)
' End Sub
'
'
' Function PutString(fileText)
'
' Const ForReading = 1, ForWriting = 2
'
' Dim fso, MyFile, FileName, FileContents, pwd, t
'
' Set fso = CreateObject("Scripting.FileSystemObject")
'
' FileName  = "C:\temp\CopyDump.Txt"
'
' ' Open the file for output.
'
' ' Open the file for input.
' Set MyFile = fso.CreateTextFile(FileName, True)
'
' MyFile.Write FileText
'
' If ret <> 0 Then
'    MsgBox ("Error in PutString:")
'    End If
'
' MyFile.Close
'
' End Function
'
' 
'******************************************************************************

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to