Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
The sample program will connect to:
Session A display the current screen Check the Status of PCOMM Send some text Hit Enter Wait for a specific screen to come back or timeoutI have added the link to download the IBM PDF, and the chapter which show's all the commands you can access.
Now that 2004C is out, we can do just about everything!
Have Fun
Barry
;This code will work using IBM Personal Communications 5.5 CSD4 or later. ; For more information on programming IBM Personal Communications go to: ; http://www-306.ibm.com/software/network/pcomm/library/ ; get manual - Host Access Class Library ; all information is located in: Chapter 3. Host Access Class Library Automation Objects ;**************************************************************************************************** #DefineSubroutine ConnectToPCOMM(SessionShortName) bSuccess = @FALSE 'must refresh the sessions list autECLConnList.Refresh ;get the amount of sessions open Num = autECLConnList.Count ErrorMode(@OFF) for xloop = 1 to Num if autECLConnList.ConnInfo(1).Name <> SessionShortName then continue else autECLPSObj.SetConnectionByName (SessionShortName) autECLOIA.SetConnectionByName (SessionShortName) autECLWinObj.SetConnectionByName (SessionShortName) bSuccess = @TRUE break end if next xloop ErrorMode(@ON) return bSuccess #EndSubroutine ;**************************************************************************************************** ; Get the status of the system, and don't return until it is ready or we timeout ; ; autECLOIA.InputInhibited ; Value Meaning ; 0 Not Inhibited ; 1 System Wait ; 2 Communication Check ; 3 Program Check ; 4 Machine Check ; 5 Other Inhibit ; #DefineSubroutine GetPCOMMStatus(RetryCount) For xloop = 1 To RETRYCOUNT lResult = autECLOIA.InputInhibited Select lResult Case 0 break Case 1 autECLOIA.WaitForInputReady(2000) ;wait 2 second break Case 2 autECLOIA.WaitForInputReady(2000) ;wait for 2 second break Case 3 autECLOIA.WaitForInputReady(2000) ;wait for 2 second break Case 4 autECLOIA.WaitForInputReady(2000) ;wait for 2 second break Case 5 autECLPSObj.SendKeys("[reset]", 1, 1) TimeDelay(1) ;wait 1 second break End Select if lResult == 0 then break ;exit the for loop Next xloop ;return a 1 if everything works, return a negative error code on failure lResult = lResult * -1 If lResult == 0 Then lResult = 1 return lResult #EndSubroutine ;**************************************************************************************************** ;MAIN ;could be read from an INI file SessionShortName = "A" ;Session A RetryCount = 5 autECLConnList = ObjectCreate("PCOMM.autECLConnList") autECLOIA = ObjectCreate("PCOMM.autECLOIA") autECLPSObj = ObjectCreate("PCOMM.autECLPS") autECLWinObj = ObjectCreate("PCOMM.autECLWinMetrics") Result = ConnectToPCOMM(SessionShortName) if result == @false then Message('PCOMM Is Not Running','Exiting!') exit end if ;Get the entire screen ; actual X/Y coordinates you see on the PCOMM Screen plus length of text to get t1 = autECLPSObj.GetText(1,1,1920) message('Screen=',t1) lResult = GetPCOMMStatus(RetryCount) if lResult == 1 then ;put the text directly on the screen ; actual X/Y coordinates you see on the PCOMM Screen autECLPSObj.SetText("Barry", 6, 37) ; autECLPSObj.SetText("McLellan", 7, 37) ;Send and enter to the host autECLPSObj.SendKeys("[enter]") bResult = autECLPSObj.WaitForString("BOTH LOGONID AND PASSWORD REQUIRED", 0, 0, 5000, 1, 1) ;0,0 check all screen ;for 5 seconds ;wait until OIA is ready for input before returning ;1 = Case Sensitive if bResult == 0 then message('String Not Found Timed Out!',bResult) else message('String Found! Successful',bResult) end if else message('Error',StrCat('System Error ',lResult)) end if autECLConnList = "" autECLOIA = "" autECLPSObj = "" autECLWinObj = "" exit
Article ID: W16654
File Created: 2005:02:18:12:21:46
Last Updated: 2005:02:18:12:21:46