My only reason for attaching the first (recorded) code sample is for reference. My question relates to the second sample of code.
In the main sub routine, I have the line PutText 9, 2, "s" followed by Update which is a function. There are seven instances of this instruction where only the row number changes (9, 11, 13, 15, 17, 19, 21).
What I would like to do is incorporate the 14 instructions into a single function loop, where the row numbers change within the function and there is just one call to that function for each screen.
In an ideal nutshell, the Update function should loop through an array of (9, 11, 13, 15, 17, 19, 21) and update each row (current update function), before moving to the next screen and recalling itself over and over.
Hopefully, someone here will be able to help. Many Thanks
Code: Select all
[PCOMM SCRIPT HEADER]
LANGUAGE=VBSCRIPT
DESCRIPTION=
[PCOMM SCRIPT SOURCE]
OPTION EXPLICIT
autECLSession.SetConnectionByName(ThisSessionName)
REM This line calls the macro subroutine
subSub1_
sub subSub1_()
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "s"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf2]"
autECLSession.autECLPS.WaitForAttrib 2,19,"38","3c",3,10000
autECLSession.autECLPS.Wait 10
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf2]"
autECLSession.autECLPS.WaitForAttrib 2,7,"00","3c",3,10000
autECLSession.autECLPS.WaitForCursor 2,8,10000
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[backtab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[backtab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "01"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf2]"
autECLSession.autECLPS.WaitForAttrib 2,7,"30","3c",3,10000
autECLSession.autECLPS.Wait 10
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf9]"
autECLSession.autECLPS.WaitForAttrib 9,1,"00","3c",3,10000
autECLSession.autECLPS.WaitForCursor 9,2,10000
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[newline]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "s"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf2]"
autECLSession.autECLPS.WaitForAttrib 2,19,"38","3c",3,10000
autECLSession.autECLPS.Wait 10
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf2]"
autECLSession.autECLPS.WaitForAttrib 2,7,"00","3c",3,10000
autECLSession.autECLPS.WaitForCursor 2,8,10000
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[backtab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[backtab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "01"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf2]"
autECLSession.autECLPS.WaitForAttrib 2,7,"30","3c",3,10000
autECLSession.autECLPS.Wait 10
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf9]"
autECLSession.autECLPS.WaitForAttrib 9,1,"00","3c",3,10000
autECLSession.autECLPS.WaitForCursor 9,2,10000
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[newline]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[newline]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "s"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf2]"
autECLSession.autECLPS.WaitForAttrib 2,19,"38","3c",3,10000
autECLSession.autECLPS.Wait 10
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf2]"
autECLSession.autECLPS.WaitForAttrib 2,7,"00","3c",3,10000
autECLSession.autECLPS.WaitForCursor 2,8,10000
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[backtab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[backtab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "01"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf2]"
autECLSession.autECLPS.WaitForAttrib 2,7,"30","3c",3,10000
autECLSession.autECLPS.Wait 10
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf9]"
autECLSession.autECLPS.WaitForAttrib 9,1,"00","3c",3,10000
autECLSession.autECLPS.WaitForCursor 9,2,10000
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[newline]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[newline]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[newline]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "s"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf2]"
autECLSession.autECLPS.WaitForAttrib 2,19,"38","3c",3,10000
autECLSession.autECLPS.Wait 10
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf2]"
autECLSession.autECLPS.WaitForAttrib 2,7,"00","3c",3,10000
autECLSession.autECLPS.WaitForCursor 2,8,10000
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[backtab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[backtab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "01"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf2]"
autECLSession.autECLPS.WaitForAttrib 2,7,"30","3c",3,10000
autECLSession.autECLPS.Wait 10
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf9]"
autECLSession.autECLPS.WaitForAttrib 9,1,"00","3c",3,10000
autECLSession.autECLPS.WaitForCursor 9,2,10000
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[newline]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[newline]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[newline]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[newline]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "s"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf2]"
autECLSession.autECLPS.WaitForAttrib 2,19,"38","3c",3,10000
autECLSession.autECLPS.Wait 10
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf2]"
autECLSession.autECLPS.WaitForAttrib 2,7,"00","3c",3,10000
autECLSession.autECLPS.WaitForCursor 2,8,10000
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[backtab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[backtab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "01"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf2]"
autECLSession.autECLPS.WaitForAttrib 2,7,"30","3c",3,10000
autECLSession.autECLPS.Wait 10
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf9]"
autECLSession.autECLPS.WaitForAttrib 9,1,"00","3c",3,10000
autECLSession.autECLPS.WaitForCursor 9,2,10000
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[newline]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[newline]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[newline]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[newline]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[newline]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "s"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf2]"
autECLSession.autECLPS.WaitForAttrib 2,19,"38","3c",3,10000
autECLSession.autECLPS.Wait 10
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf2]"
autECLSession.autECLPS.WaitForAttrib 2,7,"00","3c",3,10000
autECLSession.autECLPS.WaitForCursor 2,8,10000
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[backtab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[backtab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "01"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf2]"
autECLSession.autECLPS.WaitForAttrib 2,7,"30","3c",3,10000
autECLSession.autECLPS.Wait 10
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf9]"
autECLSession.autECLPS.WaitForAttrib 9,1,"00","3c",3,10000
autECLSession.autECLPS.WaitForCursor 9,2,10000
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[newline]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[newline]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[newline]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[newline]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[newline]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[newline]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "s"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf2]"
autECLSession.autECLPS.WaitForAttrib 2,19,"38","3c",3,10000
autECLSession.autECLPS.Wait 10
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf2]"
autECLSession.autECLPS.WaitForAttrib 2,7,"00","3c",3,10000
autECLSession.autECLPS.WaitForCursor 2,8,10000
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[backtab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[backtab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "01"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf2]"
autECLSession.autECLPS.WaitForAttrib 2,7,"30","3c",3,10000
autECLSession.autECLPS.Wait 10
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf9]"
autECLSession.autECLPS.WaitForAttrib 9,1,"00","3c",3,10000
autECLSession.autECLPS.Wait 10
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf8]"
call subSub1_()
end sub
Code: Select all
LANGUAGE=VBSCRIPT
DESCRIPTION=
[PCOMM SCRIPT HEADER]
Language = VBSCRIPT
Description =
[PCOMM SCRIPT SOURCE]
Option Explicit
autECLSession.SetConnectionByName (ThisSessionName)
OrisWriteOff
Sub OrisWriteOff()
PutText 20, 42, "20"
PressEnter
PutText 17, 44, "7"
PressEnter
PutText 5, 72, "001999"
PressEnter
PutText 9, 2, "s"
Update
PutText 11, 2, "s"
Update
PutText 13, 2, "s"
Update
PutText 15, 2, "s"
Update
PutText 17, 2, "s"
Update
PutText 19, 2, "s"
Update
PutText 21, 2, "s"
Update
PutText 1, 1, "[pf8]" 'move to next screen which will hopefully go inside (at the end of) the update function, before recalling itself over and over??
End Sub
Function WaitInpApp()
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
Do Until autECLSession.autECLOIA.InputInhibited = 0
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLOIA.WaitForAppAvailable
Loop
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLOIA.WaitForAppAvailable
Do While autECLSession.Ready = False
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLOIA.WaitForAppAvailable
Loop
End Function
Function WaitCursor()
WaitInpApp
autECLSession.autECLPS.WaitForCursor 12, 21
End Function
Function PutText(rw, cl, txt)
WaitInpApp
autECLSession.autECLPS.SetCursorPos rw, cl
autECLSession.autECLPS.SendKeys "[eraseeof]"
autECLSession.autECLPS.SendKeys txt
End Function
Function PressEnter()
WaitInpApp
PutText 1, 1, "[enter]"
End Function
Function Update()
WaitInpApp
PutText 1, 1, "[pf2]"
PutText 1, 1, "[pf2]"
PutText 1, 7, "01"
PutText 1, 1, "[pf2]"
PutText 1, 1, "[pf9]"
End Function