Search the Community
Showing results for tags 'as400'.
-
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 ^^):
-
Here is an existing AS400 PCOM script that I have: #include-once #cs ---------------------------------------------------------------------------- UDF Header Title: _PCOMM UDF Header Version: 0.1.0 AutoIt Version: 3.3.8.1 Author: Jason S. - Jewelry Supply, Inc. Script Function: PCOMM UDF Header For use with IBM AS/400 - IBM OS/400 - IBM System i - IBM i application system. This PCOMM UDF Header targets ASW - an ERP application suite written in IBM's RPG language (yuck!), although it will work for any AS/400 system and is not ASW specific. PCOMM allows injection of keystrokes into the datastream of a running terminal/console application ("Green Screen" Console Emulator). - Assumes Session 'A' but can be overriden using the aswConnect() function. PCOMM allows observing of characters in the datastream of a running terminal/console application ("Green Screen" Console Emulator). - Assumes Session 'A' but can be overriden using the aswConnect() function. #ce ---------------------------------------------------------------------------- Global $Session = "A" Global $Ps Global $Oia ; Specify session to connect to Func aswSetSession($nSession) $Session = $nSession EndFunc ; Connect to ASW ; @param $nSession - Specify session to connect to. Ex: "A" Func aswConnect($nSession = $Session) $Obj_ConnMgr = ObjCreate("PCOMM.autECLConnMgr") $OBJ_EmulSession = ObjCreate("PCOMM.autECLSession") $OBJ_EmulSession.SetConnectionByName($nSession) $Ps = $OBJ_EmulSession.autECLPS $Oia = $OBJ_EmulSession.autECLOIA EndFunc ; Send Data to ASW ; if $rownum and $colnum are not specified, defaults to the cmd line Func aswSend($keys, $rownum = 20, $colnum = 7, $inhibit = 1) $Ps.SendKeys($keys, $rownum, $colnum) if $inhibit = 1 Then While $Oia.InputInhibited <> 0 WEnd EndIf $Oia.WaitForInputReady() EndFunc ; Get Data from ASW Func aswGet($row, $col, $length) $info = $Ps.GetText($row,$col,$length) return $info Endfunc ; Check which page we are on ; @param $page - Page to see if we are on. Ex: "DMR30101" == Sales Order Maintenance page Func checkScreen($page, $rownum = 1, $colnum = 72, $length = 8) If StringInStr(aswGet($rownum, $colnum, $length), $page) Then Return 1 Else Return 0 EndIf EndFunc I would like to use it launch a connection to the AS400. I have an executable that I run with an hod file. Do I just need to run the exe and hod file then run the session connect function and send keys function to pass credentials?
- 1 reply
-
- as400
- beyondtrust
-
(and 2 more)
Tagged with:
-
So I'm trying to do some as400 automation and hit a wall when trying to get a COM object. The code on line 8 is failing, the as400.ws file opens with PCSWS.exe so I tried using that as the file path too but that didn't work either. Any and all help is greatly appreciated! $file = "C:\Users\Rhidlor\Desktop\as400.ws" If Not FileExists($file) Then MsgBox(0, "Error", "Error finding file") Exit EndIf $object = ObjGet($file) If @error Then MsgBox(0, "Error", "Error getting object") Exit EndIf $object.SendKeys("05")
-
Hello folks! I am trying to open a as400 session but no luck. Here is my code. Example() Func Example() ; Run Notepad with the window maximized. Run("C:\Program Files\IBM\Client Access\Emulator\Private\iSynergy.ws", "", @SW_SHOWMAXIMIZED) ; Wait for 4 seconds. Sleep(4000) EndFunc ;==>Example
-
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: 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?