xsh.Dialog

You can use this to manipulate the Xshell terminal​ ​screen. ​To use the following function and variable, execute it with xsh.Dialog. For example, if you want to use the MsgBox() function, append xsh.Dialog.MsgBox() in the front like this: xsh.Dialog.MsgBox().

Functions




Return Value

Function

Parameter

Description

Long

MsgBox(LPCTSTR lpszMsg)

  • LpszMsg
    String you want to send.​

Open a message box.

string

Prompt(LPCTSTR lpszMessage, LPCTSTR lpszTitle, LPCTSTR lpszDefault, BOOL bHidden)

  • lpszMessage
    The string to be displayed in the Prompt Dialog Box
  • lpszTitle
    The string to be displayed in the title bar of the Prompt Dialog Box
  • lpszDefault
    Initial default string of Prompt Dialog Box input box
  • bHidden
    If set to True, input will be hidden (e.g. *****)

Description

  • Returns user’s input from Prompt Dialog Box

Return Values

  • User’s input from Prompt Dialog Box
int

MessageBox(LPCTSTR lpszMessage, LPCTSTR lpszTitle, int nType)

  • lpszMessage
    The string to be displayed in the Message Box
  • lpszTitle
    The string to be displayed in the title bar of the Message Box
  • nType
    Dictates button types. Refer to the table below

Description

  • Displays a message box with a variety of buttons and return values depending on the user’s button selection

Return Values

  • Refer to the nType parameter description below
nTypeButtonReturn Value
0OK1
1OK / Cancel1 / 2
2Abort / Retry / Ignore3 / 4 / 5
3Yes / No / Cancel6 / 7 / 2
4Yes / No6 / 7
5Retry / Cancel4 / 2
6Cancel / TryAgain / Continue2 / 10 / 11

Script Sample (Visual Basic)

Sub Main
    Dim hostname, username, password
    hostname = xsh.Dialog.Prompt ("Insert Hostname", "Prompt Dialog", "hostname", 0)
    username = xsh.Dialog.Prompt ("Username", "Prompt Dialog", "", 0)
    password = xsh.Dialog.Prompt ("Password", "Prompt Dialog", "", 1)

    if xsh.Dialog.MessageBox("Connect to " & hostname & " server", "MessageBox",1) = 1 then
        xsh.Session.Open("ssh://" & username & ":" & password & "@" & hostname)
    End If
End Sub