![]() |
![]() |
| Home | What's New | Products | Download | Purchase | Support | About Us | Contact |
SUPPORT > TIPS
|
|
|
|
Creating A Custom Dialog Using The Internet Explorer ObjectNote: This tip is for use with SecureCRT® for Windows® A common need in scripting is the ability to create GUI interfaces for user interaction, like gathering username and password data, or displaying script output. While VBScript's MsgBox and InputBox let you script certain simple interactions, you can create more sophisticated dialogs using HTML code with the Internet Explorer (IE) object. This tip walks you through building the dialog, displaying it, and handling events in the dialog with full code samples. Creating a custom dialog for use with SecureCRT scripts involves the following steps:
Building the GUIHere is a screenshot of the custom dialog we will create:
The GUI interface for our custom dialog will be built using HTML code displayed through Internet Explorer. There are two ways to store the HTML code.
Our example will use the second method of dynamically specifying the HTML code within the script code. Below is an example of what this code might look like in the SecureCRT script for a dialog that displays fields for entering username and password, and contains OK and Cancel buttons:
Displaying the GUIDisplaying the GUI is accomplished by performing the following tasks:
Here is example code that performs these three steps:
Handling UI EventsThere are four main components of an event handler for our custom dialog using IE:
The Hidden ButtonHandler VariableThis variable is included in the HTML code and is updated every time something important happens, such as the user clicking OK or Cancel. The following HTML code for the OK and Cancel buttons sets the value of our hidden ButtonHandler variable appropriately:
and
The following code creates the ButtonHandler variable and sets its initial value to "Nothing Clicked Yet" as an explicit indication that no buttons have been pressed yet:
The Do LoopThe Do loop is used in the SecureCRT script to continue looping while checking the value of the ButtonHandler variable. In the event that the IE window is closed by means other than the Cancel button, this will be handled as well. The Select CaseThe Select Case, contained in the Do loop, is used to act on the different inputs received from the user inside custom dialog. Since the Do loop does not include a While statement that would inherently exit the loop should a certain clause be met, code to exit the loop will need to be included in the Select Case. An example of the complete Do loop with the embedded Select Case is below:
The Final ProductThe complete SecureCRT script for the custom dialog can be downloaded here. If you have any questions about using the IE object to create custom
dialogs, or other scripting questions, contact VanDyke
Software Support.
|
|||||||||
| Products | Downloads | Purchase | Support | About Us | |
|---|---|---|---|---|---|
| VShell Server | VShell Server | Buy Direct | Evaluation | Contact | |
| SecureCRT | SecureCRT | License Pricing | Updates Policy | Press Releases | |
| SecureFX | SecureFX | About Encryption Export | FAQs | What's New | |
| VanDyke ClientPack | VanDyke ClientPack | Orders FAQ | Tips & How-Tos | Customer Stories | |
| Beta Software | Beta Software | Resellers | Forums | Secure Solutions | |
|
Site Map | Legal Notices | Privacy Policy | Refund Policy VShell, SecureCRT, SecureFX, Entunnel, CRT, and AbsoluteFTP are trademarks or registered trademarks of VanDyke Software, Inc. in the United States and/or other countries. All other trademarks or registered trademarks are the property of their respective owners. Copyright © 1995 - VanDyke Software, Inc. All rights reserved. |
|||||