Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Script for IBM AS/400 session keystrokes
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Doug Howell  
View profile  
 More options Nov 13 2009, 2:44 pm
Newsgroups: microsoft.public.scripting.vbscript
From: Doug Howell <douglasehow...@hotmail.com>
Date: Fri, 13 Nov 2009 06:44:56 -0800 (PST)
Local: Fri, Nov 13 2009 2:44 pm
Subject: Script for IBM AS/400 session keystrokes
I have a script that opens a terminal session for an IBM AS/400 system
and performs a series of keystrokes.

The script works great, except if there is/are already session(s)
opened by the user.

The terminal sessions are lettered A, B, C, etc as multiple sessions
are opened by a user.

I guess I need to some how  have the script determine what the session
letter is for the one it just opened so that it uses that session
instance instead of always using session A. (which is what my code
does now)

I'm not exactly sure how to do this.

Here is the existing code:

Sub Run(ByVal sFile)
Dim shell

    Set shell = CreateObject("WScript.Shell")
    shell.Run Chr(34) & sFile & Chr(34), 1, false
    Set shell = Nothing
End Sub
'
Run "\\Dcc-1\dcc scada\AS400.ws"

Dim SessObj 'As Object
Set SessObj = CreateObject("PCOMM.autECLSession")

' Initialize the session
SessObj.SetConnectionByName ("A")

Function fwaitforappavailable(SessionID)

    Dim autECLOIAObj 'As Object

    Set autECLOIAObj = CreateObject("PCOMM.autECLOIA")
    autECLOIAObj.SetConnectionByName (SessionID)

    If (autECLOIAObj.waitforappavailable(10000)) Then
         MsgBox "Click OK to continue."
    Else
         MsgBox "Timeout Occured when waiting for the application to
become available"
    End If

End Function

Function fwaitforinputready(SessionID)

    Dim autECLOIAObj 'As Object

    Set autECLOIAObj = CreateObject("PCOMM.autECLOIA")
    autECLOIAObj.SetConnectionByName (SessionID)

    If (autECLOIAObj.waitforinputready(10000)) Then
         'MsgBox "Ready for input"
    Else
        MsgBox "Timeout Occurred when waiting for the application to
accept input"
    End If

End Function

Function fsendkeys(keyinput)

    Dim autECLPSObj 'As Object
    Dim autECLConnList 'As Object
    Set autECLPSObj = CreateObject("PCOMM.autECLPS")
    Set autECLConnList = CreateObject("PCOMM.autECLConnList")

     ' Initialize the connection
    autECLConnList.Refresh
    autECLPSObj.SetConnectionByHandle (autECLConnList(1).Handle)
    autECLPSObj.sendkeys keyinput

End Function

Function fwaitforattrib(SessionID, row, col, waitdata, MaskData,
Plane)

    Dim autECLPSObj 'As Object

    Set autECLPSObj = CreateObject("PCOMM.autECLPS")
    autECLPSObj.SetConnectionByName (SessionID)

    If (autECLPSObj.WaitForAttrib(row, col, waitdata, MaskData, Plane,
10000)) Then
         'MsgBox "Attribute " & waitdata & " found"
    Else
        MsgBox "Timeout Occurred when waiting for Attribute"
    End If

End Function

Function fwaitforcursor(SessionID, row, col)

    Dim autECLPSObj 'As Object

    Set autECLPSObj = CreateObject("PCOMM.autECLPS")
    autECLPSObj.SetConnectionByName (SessionID)

    If (autECLPSObj.waitforcursor(row, col, 10000)) Then
         'MsgBox "Cursor is at " & row & "," & col
    Else
        MsgBox "Timeout Occurred when waiting for cursor"
    End If

End Function

Function fsetcursorpos(row, col)

    Dim autECLPSObj 'As Object
    Dim autECLConnList 'As Object
    Set autECLPSObj = CreateObject("PCOMM.autECLPS")
    Set autECLConnList = CreateObject("PCOMM.autECLConnList")

     ' Initialize the connection with the first in the list
    autECLConnList.Refresh
    autECLPSObj.SetConnectionByHandle (autECLConnList(1).Handle)
    autECLPSObj.setcursorpos row, col

End Function

'REM This line calls the macro subroutine
subSub1_

sub subSub1_()
   fwaitforappavailable ("A")

   fwaitforinputready ("A")
   fsendkeys "dccscada"
   fwaitforinputready ("A")
   fsendkeys "[tab]"
   fwaitforinputready ("A")
   fsendkeys "dccscada"
   fwaitforinputready ("A")
   fsendkeys "[enter]"

   'fwaitforattrib "A",1,"20","3c",3,10000

   'fwaitforappavailable ("A")

   fwaitforinputready ("A")
   fsendkeys "[enter]"

   'fwaitforattrib "A",13,"00","3c",3,10000

   'fwaitforcursor "A",14,10000

   'fwaitforappavailable ("A")

   fwaitforinputready ("A")
   fsendkeys "1"
   fwaitforinputready ("A")
   fsendkeys "[enter]"

   'fwaitforattrib "A",6,"10","3c",3,10000

   'fwaitforcursor "A",7,10000

   'fwaitforappavailable ("A")

   fwaitforinputready ("A")
   fsendkeys "46,9"
   fwaitforinputready ("A")
   fsendkeys "[enter]"

   'fwaitforattrib "A",39,"10","3c",3,10000

   'fwaitforcursor "A",40,10000

   'fwaitforappavailable ("A")

   fwaitforinputready ("A")
   fsendkeys "0283800"
   fwaitforinputready ("A")
   fsendkeys "[tab]"
   fwaitforinputready ("A")
   fsendkeys "1"
   fwaitforinputready ("A")
   fsendkeys "[tab]"
   fwaitforinputready ("A")
   fsendkeys "n"
   fwaitforinputready ("A")
   fsendkeys "[tab]"
   fwaitforinputready ("A")
   fsendkeys "001101"
   fwaitforinputready ("A")
   fsendkeys "[enter]"
end sub


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mr_unreliable  
View profile  
 More options Nov 13 2009, 5:13 pm
Newsgroups: microsoft.public.scripting.vbscript
From: mr_unreliable <kindlyReplyToNewsgr...@notmail.com>
Date: Fri, 13 Nov 2009 12:13:36 -0500
Local: Fri, Nov 13 2009 5:13 pm
Subject: Re: Script for IBM AS/400 session keystrokes

Doug Howell wrote:
> I guess I need to some how  have the script determine what the session
> letter is for the one it just opened

hi Doug,

There is no doubt that you know a whole lot more about
the AS/400 terminal simulator than I do, but here is a
suggestion anyway.

As a "brute force" approach, you could get a list (a.k.a.
a "collection") of the terminal sessions in effect both
before and after you start your session.  If you compare
the before and after listings, then (if all goes well)
you will find one more entry in the "after" collection
than in the "before" collection.  That added entry will
be your session.

As to how to get the session collection, I was reading
here:

http://publib.boulder.ibm.com/infocenter/pcomhelp/v5r9/index.jsp?topi...

and found a class named: "autECLConnList Class".  That
class may have something you can use.

cheers, jw
____________________________________________________________

You got questions?  WE GOT ANSWERS!!!  ..(but, no guarantee
    the answers will be applicable to the questions)


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google