CAE macro for green screen updates with Excel data

S

Sriram

I am a user of the Personal Communications AS/400 (Client Access Express for
Windows) WorkStation Program IBM software. I am able to record a vbscript
macro to automate a repetitive update of our ERP using one of the ERP
options.

I need to modify the macro so that it picks up the data to be entered from
an Excel list and "types" it into the appropriate input fields. I need to
get it to process the entire list of values row by row.

Right now the macro recorder has produced a statement like
autECLSession.autECLPS.SendKeys "B11641"

which I have to replace with commands to essentially
- switch to Excel
- read the next row of data
- switch back to the terminal session
- Do the SendKeys thing

working in a loop.

I'd appreciate a sample script to do this kind of thing since I am not
familiar with the capabilities of the emulator, though reasonably
comfortable with vbscript.

Sriram
 
M

mudraker

Sriram


This will give you a start to help you solve your problem

Dim strSend As String
Dim lRow As Long
For lRow = 1 To 10 Step 1
strSend = Cells(lRow, 1).Value
autECLSession.autECLPS.SendKeys strSend
Next lRo
 
S

Sriram Narayan

Umm... I was trying to work out how to get a handle to the Excel range
from the PCOMM script.

This is what I've worked out so far:
[PCOMM SCRIPT HEADER]
LANGUAGE=VBSCRIPT
DESCRIPTION=
[PCOMM SCRIPT SOURCE]
OPTION EXPLICIT
autECLSession.SetConnectionByName(ThisSessionName)

REM This line calls the macro subroutine
CloseBlanketPO

sub CloseBlanketPO()
Dim oXL, oRange, oCell
Dim curVal, i

autECLSession.autECLPS.autECLFieldList.Refresh
If not autECLSession.autECLPS.autECLFieldList(1).GetText = "PO0110.01"
Then
MsgBox "Please invoke option PO0110 for PO maintenance" & CHR(13) & _
"before triggering this macro."
Exit Sub
End If

On Error Resume Next
Set oXL = GetObject(,"Excel.Application")
If oXL Is Nothing Then
MsgBox "You need to have the Excel list open and the Order list
selected!"
Exit Sub
Else
Set oRange = oXL.Application.Selection
End If
With autECLSession
For each oCell in oRange
curVal = oCell.Value
.autECLOIA.WaitForAppAvailable
.autECLOIA.WaitForInputReady
.autECLPS.SendKeys "B", 13, 48
.autECLPS.SendKeys curVal, 15, 48
.autECLPS.SendKeys "[field+]"
.autECLPS.SendKeys "[pf7]"
.autECLOIA.WaitForInputReady
.autECLPS.SendKeys "Y", 18, 53
.autECLPS.SendKeys "[pf5]"
' If (.autECLOIA.InputInhibited = o Then) _ 'doesn't catch the red X
II
' MsgBox "Blanket Order " & CStr(curVal) & " successfully closed."
Next
End With
End Sub

I'm still up against the problem that I can't trap an error condition
(the little red x in the status line - row 25). The InputInhibited
status apaprently does not reflect this condition. Any tips on that
one?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top