3

I've made a credentials input macro using the macro recorder of IBM Personal Communications 12.0.3.0. It simply enters my username and password when called.

sub Creds()

   Dim username
   Dim password

   username = "myUser"
   password = "myPass"


   autECLSession.autECLOIA.WaitForAppAvailable

   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys username

   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[enter]"

   autECLSession.autECLOIA.WaitForAppAvailable

   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys password

   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[enter]"

end sub

During other workflows I often have to enter my username/password multiple times to switch between windows, so I thought it would be simpler for these newer macros to just call Creds() when that type of prompt shows up. I have to change my mainframe password often as well so only replacing the password text once in the Creds() macro would be ideal.

Here is an example where I would like to use the stored Creds() procedure:

sub Login()

   autECLSession.autECLOIA.WaitForAppAvailable

   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "server name"

   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[enter]"
   
   autECLSession.autECLOIA.WaitForAppAvailable

   autECLSession.autECLPS.StartMacro "Creds"
   
end sub

My problem exists in the line autECLSession.autECLPS.StartMacro "Creds". With other attempts where I tried to use more classic vbscript commands to run the macro I would get an execution error, but with the ... .StartMacro "Creds" line - nothing happens.


Based on this documentation by IBM, the StartMacro(String MacroName) method should run the macro file located in the PCOMM user-class application data directory indicated by the MacroName parameter. I have both macros stored as separate .mac files in the user-class app data directory ("%APPDATA%\IBM\PersonalCommunications\") as specified here under 'typical installation'.

This is what I meant by a typical vbs attempt to call another macro (in place of StartMacro()):

'doesn't work
Shell "C:\Users\marcucciboy2\AppData\Roaming\IBM\Personal Communications\Creds.mac" 

'neither works
dim ObjShell
Set objShell = CreateObject("WScript.Shell")
ObjShell.Run "cscript C:\Users\marcucciboy2\AppData\Roaming\IBM\Personal Communications\Creds.mac"
'ObjShell.Run "cscript \\C:\Users\marcucciboy2\AppData\Roaming\IBM\Personal Communications\Creds.mac"

Here are two related question that I found in my research one, two, but unfortunately neither of them has a working answer.
Any advice would be appreciated!

Marcucciboy2
  • 3,156
  • 3
  • 20
  • 38

2 Answers2

0

The first link from your research states that If (macro file) has an extension, you need to either remove the extension so the call can find the macro file, or add the extension to the call statement filename. You mention that both are .mac files so you could give this a try:

autECLSession.autECLPS.StartMacro "Credentials.mac" 
Étienne Laneville
  • 4,697
  • 5
  • 13
  • 29
  • I really appreciate you taking a stab at this problem, but no luck with that answer. I get the error `Error in the script on line 21. ECL37100: Emulator interface (EHLLAPI) error. Reason code 9. Would you like to edit the script?` – Marcucciboy2 Sep 26 '19 at 18:21
0

It also says that long file names are not supported. e.g., over 8 characters. Try a shorter name for that macro file.

Parameters: String MacroName Name of macro file located in the Personal Communications user-class application data directory (specified at installation), without the file extension. This method does not support long file names.

Usage Notes: You must use the short file name for the macro name. This method does not support long file names.

  • Thanks for replying Gave, I appreciate it! I changed the file and function names to "Creds" rather than "Credentials" but I'm still not having any luck :/ – Marcucciboy2 Mar 22 '23 at 19:37
  • If you want this to work, strip out the wait statements and have it only fill in the input fields. Working with it some more, the code 9 error will show up as soon as you have any wait conditions or the presentation space is updated, as in changing screens. So you can call a another macro that does simple things but as soon as the emulator enters a wait state you get code 9 error. There is probably a way around this but examples on a 20+ year old use case are hard to find. – Gavin Hanks Apr 28 '23 at 18:11