Tapatalk

Telnet Script Access

Telnet Script Access

5
NewbieNewbie
5

    Nov 17, 2010#1

    It would save me lots of time if you could access Telnet from scripts. Ideally I want to sign onto my Solaris server and change directory on opening a project.

    Ron Webb

    262
    MasterMaster
    262

      Nov 18, 2010#2

      There are no interface between the scripting environment and SSH/Telnet consoles. But feel free to send IDM support an enhancement request. See e-mail address at the top of the page.

      But imagine something like:

      UltraEdit.showConsole(true/false); <- show/hide console window

      - - - - Handle terminal windows - - - -

      UltraEdit.terminal.length; <- number of opened terminals in console window - always at least 1

      UltraEdit.terminal[0].connect("accountname"); <- Connects a disconnected terminal window
      UltraEdit.addTerminal(); <- add new terminal window, then read new index (UltraEdit.terminal.length - 1) and connect to account

      UltraEdit.terminal[0].name; <- account name of terminal window

      UltraEdit.terminal[0].connected; <- returnes true/false - read connection status of terminal window

      UltraEdit.terminal[0].disconnect(); <- disconnects but keeps terminal window open

      UltraEdit.terminal[1].remove(); <-- removes terminal window. When only one terminal left UltraEdit.terminal.length=1, remove() has no effect

      UltraEdit.activeTerminalIdx; <- Index of active/visible terminal (read only)

      UltraEdit.terminal[0].setActive(); <- set this terminal active

      - - - - Handle individual terminal - - - -
      (Interface for terminal uses existing interface based on select/copy/paste)

      UltraEdit.terminal[0].copyAll(); <- copy all content of terminal window buffer (as much as are available) to active clipboard
      UltraEdit.terminal[0].copy(); <- copy only content on terminal window buffer (as much as are available) since last action (paste() or connect())

      (You can then access the content on the clipboard in the script and evaluate/parse the
      result of your last command or your login).

      (You then place next full command and "LF" on the clipboard - like: UltraEdit.clipboardContent = "cd /tmp"+ "\n"; )

      UltraEdit.terminal[0].paste(); <- Paste contents of active clipboard to terminal window

      Example: Where have we landed after login ?

      Code: Select all

      UltraEdit.clipboardContent = "pwd"+ "\n"; /* construct command */
      UltraEdit.terminal[0].paste(); /* send command */
      UltraEdit.terminal[0].copy(); /* read screen since last action to this action */
      var terminalOutputLines = UltraEdit.clipboardContent.split("\n");
      if(terminalOutputLines.length>0) {
        if(terminalOutputLines[0]=="/home/myhome/") {
          ...in the right place...
        }
        else {
          ... then what ?...
        }
      }
      else { ... error handling ...}
      I think I will send this suggestion to IDM. But everybody else who thinks it is a good idea should do the same since the more people who request a feature the more likely it is that the feature is implemented in future versions of UE.

      Cheers!