vbavbscriptibm-pcomm

vbscript starting a specific profile connection in ibm personal communications


I have been given the task of converting the slower Macro Express Pro coding for IBM Personal Communications over to a VBScript/VBA version. The Macro Express Pro coding opens a predetermined profile from a specific location.

enter image description here

This process can take up to 30 seconds. VBScript does this in about a third of the time for a default profile (TN3270.WS). However, when we try opening the specific link highlighted in the UNET.txt file, we get this as an error:

Run-time error '440': Automation error

Here is the VBScript code we are trying to use:

Sub Main()
    Dim EName
    Dim autECLConnList, objConnMgr

    Set objConnMgr = CreateObject("Pcomm.autECLConnMgr")
    objConnMgr.autECLConnList.Refresh
    objConnMgr.StartConnection ("profile='C:\ProgramData\IBM\Personal Communications\UNET REWORK.ws' connname=a")
    Application.Wait (Now + TimeValue("00:00:12"))
    objConnMgr.autECLConnList.Refresh
    EName = objConnMgr.autECLConnList(1).Name
End Sub

The error occurs on the objConnMgr.StartConnection ("profile='C:\ProgramData\IBM\Personal Communications\UNET REWORK.ws' connname=a") line. We know we have the correct path to the profile because it's we found its location:

enter image description here

IBM says that if the profile name contains blanks, it "must to be surrounded by single quotes":

enter image description here

Can anyone provide some advice on what we're doing wrong or what we're missing?

Thanks.


Solution

  • I found a way of doing what I need to do. I was looking too specific into starting a PCOMM session that I didn't even think of just running the .exe file and send it parameters. Here's how I did it:

    Sub Main()
        Dim WShell
    
        Set WShell = CreateObject("WSCript.shell")
    
        WShell.Run """C:\Program Files (x86)\IBM\Personal Communications\pcsws.exe"" ""C:\ProgramData\IBM\Personal Communications\UNET REWORK.WS"""
    End Sub
    

    I'm sure this is a duplicate answer to another question out there, but most of the answers are more than a few years old and outdated. This solution is current and recently tested, so it is a more reliable source.