Autoconnect and switch between two sessions

Version 1

    Verified Product Versions

    Wavelink Naurtech CETerm 5.7

    This script will toggle between two sessions, S1 (session 1) and S2 (session 2) and will connect the session if it is not connected. It assumes that the session connection settings are already configured. One way to use this script is to "bind" (associate it with) it to a physical key. Pressing that key will then jump between two the two sessions and connect the session if it were disconnected.

     

    The script assumes toggle between sessions S1 and S2. You can modify these to suite your requirements. It retrieves the current active session and issues a "Connect" on the other session. Note CETerm.PostIDA( "IDA_SESSION_CONNECT", 0 ); will force a session connect only if it is not already connected.

     

    /* Toggle Session */

    function ToggleSession()

    {

       var currentSession = CETerm.ActiveSession;

       if (currentSession == 1)

       {

            // Switch to session 2.

            CETerm.SendIDA( "IDA_SESSION_S2", 0 );

     

            // Connect session if not connected.

            CETerm.PostIDA( "IDA_SESSION_CONNECT", 0 );

       }

       else

       {

            // Switch to session 1.

            CETerm.SendIDA( "IDA_SESSION_S1", 0 );

             // Connect session if not connected.

            CETerm.PostIDA( "IDA_SESSION_CONNECT", 0 );

       }

    }