Popular Post Neutro Posted April 28, 2017 Popular Post Posted April 28, 2017 (edited) Hey guys! Here are some informations on how to automate AS400 tasks with AutoIT. AS400 are mainframes made by IBM and used mainly in professional workplaces. First you need to launch an IBM Iseries console to the AS400. It looks like this: As it is a regular window, you can use the "AutoIT Window Info" tool and functions like "ControlSetText", "ControlClick" to automate the login process. Notice that the name of the window (in the top left of the above screenshot) is "Session A". This is because it is the first Iseries window that is opened on the client computer. If you do not close it and open another one, the next one will be named "Session B". The third one "Session C"... Once you're logged into the Iseries console interface, the OS400 login window shows up: Use this code to create an autoIT object linked to the iseries console: global $oOIA = ObjCreate("PCOMM.autECLOIA") $oOIA.SetconnectionByName("A") global $oPS = ObjCreate("PCOMM.autECLPS") $oPS.SetConnectionByName("A") The letter "A" is a reference to the name of the session displayed in the iseries console window, as explained before. Change it to another letter if you have multiples iseries console windows opened at the same time. Then there are 3 main functions that you can use to interact with the interface: $oOIA.WaitForInputReady() ;waits for the interface to be ready for input. $oPS.SetCursorPos(6, 53) ;put the cursor of the interface to position X = 6, Y = 53 $oPS.SendKeys("hello world[enter]") ;write the text "hello world" where the cursor of the interface is then press the enter/return key $result = $oPS.SearchText("banana") ;search for the text "banana" on the interface screen. Returns "True" if found, "False" if not. The function "WaitForInputReady" is badfully not very reliable. For better results, use the fuction "SearchText" in a while loop to wait for a specific text to appear on the interface if you want to be sure that the interface is ready for input. With these 3 functions you can pretty much do anything you would do manually on an Iseries console. Special keys for the "SendKeys" function can be found using the virtual keyboard included in the iseries console software. Enjoy Original post (credit to @DangerousDan and @bwochinski) for helping me understand the above stuff ^^): Edited October 5, 2020 by Neutro adding a link to the original topic IErrors, argumentum, PhilippeLabarre and 3 others 6 Identify active network connections and change DNS server - Easily export Windows network settings Clean temporary files from Windows users profiles directories - List Active Directory Groups members Export content of an Outlook mailbox to a PST file - File patch manager - IRC chat connect example Thanks again for your help Water!
IErrors Posted May 12, 2017 Posted May 12, 2017 This is great - It's cool to see someone else interested in AS400 automation! A few years ago I developed an application for my employer that automated iSeries and wrote a massive library to operate on these PCOMM classes. I found that using the AutScreenDesc class was a very reliable way of waiting for a screen by first describing it then calling the WaitForScreen() method. Alternatively, the WaitForString() and WaitForStringInRect() methods work just as well. I also found the SetConnectionByHandle() method was a bit more reliable when dealing with multiple sessions. I wish I could share the lib, but unfortunately it technically doesn't belong to me Though IBM provides a wealth of knowledge on these classes here and even provide VB example code which makes it super easy to translate into AU3. plao and Neutro 2
ViciousXUSMC Posted August 3, 2017 Posted August 3, 2017 Not sure what I will need this for yet, but I know I will. Just got assigned t he AS400 and do not know a thing about it. First things first, gotta go figure out where to get the PTF's and how to install them. Neutro 1
Neutro Posted August 4, 2017 Author Posted August 4, 2017 Welcome to the AS400 world PTFs are the windows updates of AS400, so IBM are providing them Fyi all moderns AS400 are virtual and run on an IBM hypervisior (the same way a VM runs on ESXi), so I recommend you backup your virtual AS400 image before trying anything argumentum 1 Identify active network connections and change DNS server - Easily export Windows network settings Clean temporary files from Windows users profiles directories - List Active Directory Groups members Export content of an Outlook mailbox to a PST file - File patch manager - IRC chat connect example Thanks again for your help Water!
ViciousXUSMC Posted August 4, 2017 Posted August 4, 2017 (edited) 5 hours ago, Neutro said: Welcome to the AS400 world PTFs are the windows updates of AS400, so IBM are providing them Fyi all moderns AS400 are virtual and run on an IBM hypervisior (the same way a VM runs on ESXi), so I recommend you backup your virtual AS400 image before trying anything Not ours. Not one but 2 physical machines and we have a TON of other servers and services that interface it. Some of those might be virtual, not sure yet. Edited August 4, 2017 by ViciousXUSMC
Neutro Posted August 5, 2017 Author Posted August 5, 2017 (edited) 13 hours ago, ViciousXUSMC said: Not ours. Not one but 2 physical machines and we have a TON of other servers and services that interface it. Some of those might be virtual, not sure yet. When you have 2 physical machines, 1 is usually dedicated to business operations and the other one to backup/test. I find it unlikely that your 2 physical machines are not hypervisors. If they are not then your hardware is most likely kinda old ^^ As i told you by PM you should try to contact IBM support Edited August 5, 2017 by Neutro Identify active network connections and change DNS server - Easily export Windows network settings Clean temporary files from Windows users profiles directories - List Active Directory Groups members Export content of an Outlook mailbox to a PST file - File patch manager - IRC chat connect example Thanks again for your help Water!
PhilippeLabarre Posted February 22, 2018 Posted February 22, 2018 Thanks for the information, that is very helpful. I almost succeed to do what I try to do. I tried to get screen content using GetScreen function but I always got errors. Is it my syntaxe or it's not possible to use that function ? My code. global $oOIA = ObjCreate("PCOMM.autECLOIA") $oOIA.SetconnectionByName("A") global $oPS = ObjCreate("PCOMM.autECLPS") $oPS.SetConnectionByName("A") Global $actualKw $oPs.GetScreen($actualKw, 51, 9, 18, 50); MsgBox($MB_SYSTEMMODAL,"Actual Web Keyword", _ArrayDisplay($actualKw))
PhilippeLabarre Posted February 22, 2018 Posted February 22, 2018 I got what I wanted by using $oPs.GetText(9, 18, 50); Neutro 1
Charlie12 Posted July 1, 2020 Posted July 1, 2020 Hi Guys, im new on this and i'm trying to automate an AS400 console, im following the example of Neutro but when trying to declare the variables im having the following error: "C:\Windows_x86-64\TestScript.au3" (4) : ==> Variable must be of type "Object".: $oOIA.SetconnectionByName("TESTENV") $oOIA^ ERROR Following the code: global $oOIA = ObjCreate("PCOMM.autECLOIA") $oOIA.SetconnectionByName("TESTENV") global $oPS = ObjCreate("PCOMM.autECLPS") $oPS.SetConnectionByName("TESTENV") RunWait("acslaunch_win-64.exe") Sleep(5000) If you can give me a light on how to get around of this error or do the SetCursorPos on the window it will be appreciated. Thanks.
Neutro Posted July 23, 2020 Author Posted July 23, 2020 Hey, Sorry to answer a bit late but better late than never ;) For this to work you need to have the IBM iseries software installed on your computer and check that you can effectively use it to connect to interface with your AS400 with the 5250 emulator as displayed in my screenshots in my first post. If you do not have the iseries software and the 5250 interface emulator installed the object creation will fail in autoIT and you will get the error message that you had. Also in your code you used SetconnectionByName("TESTENV") but "TESTENV" here is wrong. Please read again my first post, instead of "TESTENV" this should be the letter of the session that is displayed when you open the 5250 interface emulator as shown in my screenshots (letter A and B in my examples). If you set anything else than the right letter in SetconnectionByName the code will fail. Also if i recall correctly, when i did this post back in 2017 it was on windows 7. If my memory is right i've tried using the same on Windows 10 and it also worked, but i'm not 100% sure. Also i just checked and saw that the "IBM i Access for Windows" software that includes the iseries software that i'm referring to has been discontinued if i'm not wrong: https://www.ibm.com/support/pages/ibm-i-access-windows and replaced by the new version called "IBM i Access Client Solutions". I stopped working on AS400 for a while now so i dont know if the code in my first post still work with this version, but even if IBM say in their article that the first version of I Access for Windows has been discontinued and does not support Windows 10, it might still work properly as i tested it back then when i was working on migrating our IT from windows 7 to win10 and had no problems. Identify active network connections and change DNS server - Easily export Windows network settings Clean temporary files from Windows users profiles directories - List Active Directory Groups members Export content of an Outlook mailbox to a PST file - File patch manager - IRC chat connect example Thanks again for your help Water!
Ravali Posted September 18, 2020 Posted September 18, 2020 (edited) Hi , Error message “unknown function name” is thrown when trying to create objects for autECLOIA or autECLPS. Do we have to include any libraries before hand. If so how to include them. I have gone threw different posts but unable to find the libraries or how to include them. Thanks in advance. @water: could you provide me an advice on the above issue. Edited September 23, 2020 by Ravali
water Posted September 23, 2020 Posted September 23, 2020 I have never worked with AS400, just with IBM mainframes. You have to make sure that the correct software and the correct version is installed (as Neutro describes above). How to do this and how to set up the computer for automation is described in the docu of the software. Sorry for not being more specific but that's all I can do based on the information you provide. 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
Ravali Posted September 24, 2020 Posted September 24, 2020 @water/ @Neutro : Sorry for the less information provided. I am just trying to connect and automate ibm as400 database using autoit.Do i have to include or download any libraries for auto it to recognize the below statements. Unknown function name is thrown when trying to create object for autECLOIA or autECLPS. global $oOIA = ObjCreate("PCOMM.autECLOIA") $oOIA.SetconnectionByName("A") global $oPS = ObjCreate("PCOMM.autECLPS") $oPS.SetConnectionByName("A")
Danp2 Posted September 24, 2020 Posted September 24, 2020 Sounds like either you don't have the correct software from IBM installed or one of their libraries isn't properly registered. Latest Webdriver UDF Release Webdriver Wiki FAQs
mLipok Posted September 24, 2020 Posted September 24, 2020 @Ravali to forum. Please make a small reproducer just how you create object and connect, of course do not forget to anonymize your security related data. Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
water Posted September 24, 2020 Posted September 24, 2020 But please first answer Danp2' s questions. Which software do you use? Which version do you use? 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
Ravali Posted September 25, 2020 Posted September 25, 2020 Hi, I am able to access the AS400 Ibm sessions manually. But facing the issue when trying to automate through autoit. As am able to access the application without any issue , I dnt think this might be the download problem of the software. I am using IBM Personal Communications iseries as neutro mentioned in his first post. Session manager version 6.0 for windows is used. The code in autoit is Global $oOI=ObjCreate(“PCOMM.autECLOIA”) Global $oPS=ObjCreate(“PCOMM.autECLPS”) this might be a silly mistake but am unable to figure it out as am new to autoit. Thanks in advance.
water Posted September 25, 2020 Posted September 25, 2020 Maybe when installing PComm the libraries needed by AutoIt haven't been selected and hence are now missing? 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
mLipok Posted September 25, 2020 Posted September 25, 2020 (edited) 14 hours ago, mLipok said: Please make a small reproducer just how you create object and connect, of course do not forget to anonymize your security related data. Again please post small reproducer to this 2 hours ago, Ravali said: Global $oOI=ObjCreate(“PCOMM.autECLOIA”) Global $oPS=ObjCreate(“PCOMM.autECLPS”) Complete I mean which you run to check.... Edited September 25, 2020 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
water Posted September 25, 2020 Posted September 25, 2020 (edited) According to this post you need to create objects for the connection manager and a session and then you call autECLOIA and autECLPS. Could you please give this code a try? Edit: You need HACL (Host Access Class Library) objects as described here to automate a PCOMM session. A good overview can be found here. My understanding is that at least you have to create a connection. Edited September 25, 2020 by water 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now