Group: ibm.software.pcomm




Subject: PCOMM 5.9: VBScript macro cannot connect HACL NotifyKeyEvent event handler to autECLPS object
From: Graham Hannington
Date: 2/20/2007 6:12:24 PM
I'm trying to write a PCOMM 5.9 VBScript macro (Windows XP Pro SP2) that captures keystrokes in a PCOMM session. I've read the "Scripting Events" article by Microsoft: http://msdn2.microsoft.com/en-us/library/ms974564.aspx and I've read the relevant sections in the "Host Access Class Library Automation Objects" topic of the PCOMM infocenter: http://publib.boulder.ibm.com/infocenter/pcomhelp/v5r9/index.jsp?topic=/com.ibm.pcomm.doc/b ooks/html/host_access08.htm My PCOMM .mac runs a Windows script file: WshShell.Run "wscript.exe """ & strScriptFilePath & """",,True which contains the following <object> element: <object progid="PCOMM.autECLPS" id="autECLPS_A" events="true"/> and the following code: autECLPS_A.SetConnectionByName("A") autECLPS_A.RegisterKeyEvent ' Blocking call WScript.Echo "Waiting for instances." ... Sub autECLPS_A_NotifyKeyEvent(KeyType, KeyString, PassItOn) .... MsgBox "Hello world" .... End Sub I run the script from a PCOMM session B, so that the "blocking call" does not stop me from entering keystrokes into session A. A SendKeys to session A (the autECLPS_A object) or B works just fine, so those objects have been defined okay. I think I'm doing the right thing with the <object> element to ensure correct binding of the event handler to the object, but I get no "Hello world" when I run the script and start typing in session A. (If, instead, I use CreateObject and then WScript.ConnectObject, the ConnectObject fails.) Any ideas?