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!
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
.macfiles so you could give this a try: