Jump to content

IBM i Access Client Solutions... with AutoIt


Recommended Posts

Hi all,

this is very specific. I'm an administrator for several IBM i Power mainframe servers that run i5/OS and people use the Client Access Software.
For now I've been using the Host Access Class Lib in my AutoIt Scripts on Client Access to automate most of my tasks.

The essential code lines are this:

Spoiler
$objECLSession = ObjCreate("PCOMM.autECLSession")
$objECLSession.SetConnectionByName($lb_Selected)

 


After this you can use the methods listed here to remote-control your Client Access session. Much like a macro.

This worked fine for the Client Access software. Now IBM released their new IBM i Access Client Solutions and I can't get it to work with it.

Does anyone have any experience with this already by chance?

Edited by Radiance
Link to comment
Share on other sites

  • Moderators

"Can't get it to work" doesn't tell us a great deal. Are you unable to create the object, access it after creation, etc. etc. etc.? Help us help you ;)

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Hi,
my bad, here's the code.
If the func succeeds, $a will become the var that contains the actual global ECLSession object for further use in other functions.
 

Spoiler

 

Global Const $_gi_GUIClose = -3
Global $a

_SelectConnectionEx($a)

Func _SelectConnectionEx(ByRef $po_objECLSession)
    Local $go_ConList = ObjCreate("PCOMM.autECLConnList")
    $go_ConList.Refresh
    Local $gi_Sessions = $go_ConList.Count

    Local $li_GUI = GUICreate("Select session (" & $gi_Sessions & ")", 300, 38 * $gi_Sessions)
    Local $lia_Buttons[$gi_Sessions]
    Local $lb_Selected = False
    Local $ls_WindowName
    Local $li_GUIMsg

    Local $lsa_SessionWinTitle[$gi_Sessions]
    Local $lsa_SessionName[$gi_Sessions]
    Local $lsa_SessionWMConnections[$gi_Sessions]

    For $i = 0 To $gi_Sessions - 1
        $lsa_SessionName[$i] = $go_ConList($i + 1).Name
        $lsa_SessionWMConnections[$i] = ObjCreate("PCOMM.autECLWinMetrics")
        $lsa_SessionWMConnections[$i].SetConnectionByName($lsa_SessionName[$i])
        $lsa_SessionWinTitle[$i] = $lsa_SessionWMConnections[$i].WindowTitle
        $lia_Buttons[$i] = GUICtrlCreateButton($lsa_SessionWinTitle[$i], 10, 10 + 35 * ($i), 280, 30)
    Next

    GUISetState(@SW_SHOW)

    While 1
        $li_GUIMsg = GUIGetMsg()

        Sleep(50)

        For $i = 0 To $gi_Sessions - 1
             If $li_GUIMsg = $lia_Buttons[$i] Then
                $lb_Selected = $lsa_SessionName[$i]
                $ls_WindowName = $lsa_SessionWinTitle[$i]
            EndIf
        Next
        If $li_GUIMsg = $_gi_GUIClose Then Exit

        If $lb_Selected <> False Then ExitLoop
    WEnd

    GuiDelete()

    $po_objECLSession = ObjCreate("PCOMM.autECLSession")
    $po_objECLSession.SetConnectionByName($lb_Selected)

    If Not IsObj($po_objECLSession) Then
        MsgBox(16, "Kritischer Fehler", "Konnte ECLSession-Objekt " & _
            "nicht erstellen." & @CRLF & "Programm wird beendet.")
        Exit
    EndIf

    Return $ls_WindowName
EndFunc

 


It already fails at the third line of the function. It counts every connected Legacy Client Access session, however leaves out any connected session created via Client Solutions.

Edited by Radiance
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...