Jump to content

Recommended Posts

Posted

I want to know if there is a possibility of automating the AS400 through the object I have already searched but I can't find the option that worked for me, I tried the following and it doesn't work.

;Code 1
$Obj_ConnMgr = ObjCreate("PCOMM.autECLConnMgr")
$OBJ_EmulSession = ObjCreate("PCOMM.autECLSession")
$OBJ_EmulSession.SetConnectionByName($nSession)

;Code 2
global $oOIA = ObjCreate("PCOMM.autECLOIA")
$oOIA.SetconnectionByName("A") 
global $oPS = ObjCreate("PCOMM.autECLPS")
$oPS.SetConnectionByName("A")

I tried these two options but it doesn't work, of course taking into account that the AS400 session has already been started and it is in its main window.

It throws me the following error

image.png.86a22fd5c0ef82a1a75a02cacb39c0e5.png

Posted

I suggest to add a COM error handler to your script. That's the way to get a more detailed error description.
Please see ObjEvent in the help file.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted (edited)

Your comp may not have access to those objects.  Have you tested that they are effectively objects ?  Add this after each ObjCreate :

if not IsObj($yourObjectGoesHere) then exit MsgBox(0,"Error","Not an object")

You may need to register the appropriate dll in order to access them (google is your friend).

Edited by Nine
Posted

google: Host Access Class Library Automation Objects as400

Example for VBA with the com objects should not be hard to translate to AutoIt

https://github.com/dentemple/VBA-Class-For-AS400-Automation-Objects

 

Your example with $objCreateEmulSession  is not the same variable as you have in code 1` $OBJ_EmulSession so it could be caused by not having initialized your variable at all.

Posted (edited)

With the information you give we probably can not help.

  • I want to know if there is a possibility of automating the AS400 through the object 
    Yes its possible

So dozens of questions I can ask but as me and others do not have access to your environment you should try and search yourself

  1. Do you have a working terminal emulator on the PC you are trying to run this that connects to AS/400?
    I think you did but maybe do not run that in parallel.
  2. Are the HACL object libraries registered/installed on your PC?
  3. Are you running from 32 bits AutoIt? you should.
  4. Did you try any of the VBA examples you can find on the internet? See the link I gave earlier and try to run that from within Excel VBA
        ' Must be set independently
        Set pConnectionManager = CreateObject("PCOMM.autECLConnMgr")
        Set pSessionInformation = CreateObject("PCOMM.autECLSession")
        
        ' Note: autECLSession session must be set prior to sub-classing _
            any additional classes under it.
        pSessionInformation.SetConnectionByName (sessionName)
        
        ' Can be connected to a higher object for convenience
        Set pConnectionList = pConnectionManager.autECLConnList
        Set pOperatorInformation = pSessionInformation.autECLOIA
        Set pPresentationSpace = pSessionInformation.autECLPS
        Set pWindowMetrics = pSessionInformation.autECLWinMetrics
        
        ' Recommended by the documentation, but not required
        pConnectionList.Refresh

should then be

$pConnectionManager = ObjCreate("PCOMM.autECLConnMgr")
$pSessionInformation = ObjCreate("PCOMM.autECLSession")
$pSessionInformation.SetConnectionByName ("A")
     
' Can be connected to a higher object for convenience
$pConnectionList = pConnectionManager.autECLConnList
$pOperatorInformation = pSessionInformation.autECLOIA
$pPresentationSpace = pSessionInformation.autECLPS
$pWindowMetrics = pSessionInformation.autECLWinMetrics
        
' Recommended by the documentation, but not required
$pConnectionList.Refresh

 

Edited by junkew
Posted

PCOMM stands for IBM's Personal Communications product. This needs to be installed on the computer where you try to run your script.
Can you please check the installed software?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

@ElPandaRojo1

you dont have PCOMM installed in your system that why you got error.

Download PCOMM Fromhttps://www.ibm.com/resources/mrs/assets/packageList?source=RATLe-PCOM-EVAL&lang=en_US:

-Register

-Login

-Choose IBM Personal Communications (PCOMM) 14.0.4 for Windows Multilingual Trial eAssembly
14.00.01

-Click Continue

--Download IBM Personal Communications (PCOMM) 14.0.4 for Windows Multilingual Trial eAssembly

-Extract mtri0504.rar

-Launch Setup.exe from:\mtri0504\mtri0504\combo\Disk1\Setup.exe

-Enjoy using PCOMM obj.

none

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...