July 26th’s release of Xshell we’ve includes the ‘xsh.Dialog.IsPromptCanceled’ variable. This allows you to confirm if a user clicked the Cancel button of an xsh.Dialog.Prompt. Update to at least the following builds to use this variable:
Xmanager Power Suite 6 Build 0007
Xshell Plus 6 Build 0007
Xshell 6 Build 0095
Xshell has various script functions and of these functions, xsh.Dialog.Prompt accepts user input. To read more about xsh.Diaolog.Prompt, please see here: https://blog.netsarang.com/en/779/xshell-script-api-prompt-message-box/
It was brought to our attention that previous builds of Xshell made no distinction between xsh.Dialog.Prompt returning an empty string or the user pressing cancel (i.e. pressing “Cancel” simply emulated pressing “OK” with an empty string). However, it was important to differentiate between a user explicitly entering an empty string and a user pressing cancel. Thus, we have included xsh.Dialog.IsPromptCanceled in the latest build.
The following is an example of a JS script using xsh.Dialog.IsPromptCanceled:
function Main(){ var strRef = xsh.Dialog.Prompt("Input a value.", "Test", "", 0); if (xsh.Dialog.IsPromptCanceled) xsh.Dialog.MsgBox("Cancel was selected."); else if (strRef == "") xsh.Dialog.MsgBox("No value was inputted."); else xsh.Dialog.MsgBox("Input value : " + strRef); }