Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Extra Personal Client Short Session Names
This is a piece of the code...
Also the DLL's where placed to be loaded in the same directory from where I'm testing this script.
; ----- Run the Profile Session ----- Title01 = 'Test ehllapiRunProfile()' SessionName = "CITIBANKQA" SessionExtension = ".EDP" ProfileName = STRCAT("D:\winbatch\tests\", SessionName, SessionExtension) ; Macro at Extra Client - C:\Program Files\E!PC\Macros\Startup.ebm RunFlags = 1 ; Displays a window - shownormal ; Loads the EXTRA Mainframe HLLAPI DLL and uses the Enhanced interface specs. ErrorMode(@OFF) MFDLL = "EHLAPI32.DLL" ; This is the right one ;MFDLL = "WHLAPI32.DLL" ;MFDLL = "WHLLAPI.DLL" ; ; -*-*-*-*-* Works fine from here since loads the DLL -*-*-*-*-*-* ehllapiInit('%MFDLL%', '', @FALSE) ResultCode = LastError() ErrorMode(@CANCEL) TempMsg = StrCat('ehllapiInit("%MFDLL%", "", @TRUE) RC = ', ResultCode, @CRLF) Message(Title01, TempMsg) Title01 = 'Test ehllapiVersion()' MajorVerNum = ehllapiVersion(0) FullVerStr = ehllapiVersion(2) TempMsg = StrCat('Major version number = ',MajorVerNum,@CRLF) TempMsg = StrCat(TempMsg,'Full version string = ',FullVerStr) Message(Title01,TempMsg) ; ErrorMode(@OFF) ; Result = ehllapiRunProfile(Profilename, RunFlags) ; ResultCode = LastError() ; ErrorMode(@CANCEL) ; TempMsg = StrCat('ehllapiRunProfile("',ProfileName,'",',RunFlags,') RC = ', ResultCode, @CRLF) ; TempMsg = StrCat(TempMsg, @CRLF, 'Result = ', Result) ; Message(Title01, TempMsg) ;=;=;=;= tracefile=".\wbdebug.txt" if fileexist(tracefile) filedelete(tracefile) endif DebugTrace(@ON, tracefile) ; -*-*-*-*-* Works fine from here since loads the Extra Session -*-*-*-*-*-* SHELLEXECUTE("Extra.exe", "%ProfileName%", "", @NORMAL, "") TimeDelay(7) If WinExist("EXTRA! Basic Error") == @TRUE Then WinActivate("EXTRA! Basic Error") If WinExist("EXTRA! Basic Error") == @TRUE Then SendKey("~") If WinExist("~%SessionName%") == @TRUE Then WinActivate("~%SessionName%") ; -*-*-*-*-* Does not work from here since does not perform the ConnectPS with Extra Session -*-*-*-*-*-* ; ----- Through the Profile Session configure session as A ----- ; Assuming that an EXTRA session is running and is configured to use the ; short session name "A", we'll try to connect to it. ErrorMode(@OFF) ehllapiConnectPS('A') ResultCode = LastError() ErrorMode(@CANCEL) TempMsg = StrCat('ehllapiConnectPS("A") RC = ', ResultCode, @CRLF) Message(Title01, TempMsg) ; Now we can do some screen-scraping work, etc... ; ----- Wait for session input inhibited ----- ; Wait for the presentation space to be ready to accept keystrokes before we ; send the login commands... ErrorMode(@OFF) ehllapiWait() ResultCode = LastError() ErrorMode(@CANCEL) IF (ResultCode != 0) TempMsg = StrCat('ehllapiWait() RC = ',ResultCode,@CRLF) TempMsg = StrCat(TempMsg,@CRLF,'Presentation space is not ready to accept keystrokes! Aborting...') Message(Title01,TempMsg) ; EXIT ENDIF ; ----- Search for on-screen messsage ----- ErrorMode(@OFF) Result = ehllapiSearchPS(0,'','You are authorized') ResultCode = LastError() ErrorMode(@CANCEL) TempMsg = StrCat('ehllapiSearchPS(0,"","You are authorized") RC = ', ResultCode, @CRLF) IF (ResultCode == 0) TempMsg = StrCat(TempMsg,@CRLF,'Text Row = "',Result[0],'"') TempMsg = StrCat(TempMsg,@CRLF,'Text Column = "',Result[1],'"') ENDIF Message(Title01,TempMsg) ; ----- Send LTAPRP to establish COSMOS session ----- ; Let's send LTAPRP before login in order to establish the mainframe session RCScreenPosition = ArrDimension(2) RCScreenPosition[0] = 15 RCScreenPosition[1] = 8 ehllapiCopyTexttoPS(0, RCScreenPosition, "ltaprp","") ; ----- Wait for session input inhibited ----- ; Wait for the presentation space to be ready to accept keystrokes before we ; send the login commands... ; ErrorMode(@OFF) ; ehllapiWait() ; ResultCode = LastError() ; ErrorMode(@CANCEL) ; IF (ResultCode != 0) ; TempMsg = StrCat('ehllapiWait() RC = ',ResultCode,@CRLF) ; TempMsg = StrCat(TempMsg,@CRLF,'Presentation space is not ready to accept keystrokes! Aborting...') ; Message(Title01,TempMsg) ; EXIT ; ENDIF ehllapiSendKey(KeyEnter) ; ----- Wait for session input inhibited ----- ; Wait for the presentation space to be ready to accept keystrokes before we ; send the login commands... ErrorMode(@OFF) ehllapiWait() ResultCode = LastError() ErrorMode(@CANCEL) IF (ResultCode != 0) TempMsg = StrCat('ehllapiWait() RC = ',ResultCode,@CRLF) TempMsg = StrCat(TempMsg,@CRLF,'Presentation space is not ready to accept keystrokes! Aborting...') Message(Title01,TempMsg) EXIT ENDIF
Also, have you tried moving the call to ehllapiInit() to happen *AFTER* the ShellExecute() function has returned and you've verified that Attachmate has successfully established a connection to the mainframe?
First, in order to be able to connect(using ehllapiConnectPS('A')) Extra client does not allow a short session name unless you have set the session name previously. Once you load your saved Extra session, must perform either by registry or by sendkey, the Short name session assignment.
By sendkey:
Once the Extra saved session is loaded must select Options, Global Preferences, select tab named Advanced, select from the Short name session document section the letter you want to assign(in this example A since using ehllapiConnectPS('A')), hit the Browse button and assign the full path into the Open dialog(in my example I have my session saved in c:\program files\E!PC\Sessions\CITIBANKQA.EDP), hit the Open button(of this Open dialog), now returns to the Global Preferences screen tab, hit the Apply button, hit the OK button. Now the ehllapiConnectPS('A') command will work. Steps in my code were to load the Extra session, Load the ehlapi32.dll through ehllapiInit, and then establish a short name session through ehllapiConnectPS('A').
By Registry:
Don't know if it will work exactly the same in version 7 but at least did for me using 6.2 through 6.4.
Thanks for your ideas.
On your
2:REG_SZ:C:\Program Files\E!PC\Sessions\CITIBANKQA.EDP,,25,80,2443275,0
and what I did is to change it as follows
2:REG_SZ:C:\Program Files\E!PC\Sessions\CITIBANKQA.EDP,A,25,80,2443275,0
Article ID: W15405
File Created: 2003:05:13:11:27:30
Last Updated: 2003:05:13:11:27:30