![]() |
|
|
|
#1
|
|||
|
|||
|
Dialog.Prompt
Hi,
Is there a way to tell the difference between a user clicking on cancel vs not filling out the field and just clicking return when using the Dialog.Prompt command? The Manual just states that the string entered is returned if OK is clicked. It looks like it returns a null string if either cancel is clicked or nothing is entered and ok is clicked. I would like the script to exit if Cancel is clicked, but for this prompt, a null string would be a valid entry... Thanks, Wes |
|
#2
|
|||
|
|||
|
I recently had a issue like this. I have to defer to Vandyke support for the real answer.
However, I think you could pre-fill the answer with a blank or some other information. Then if someone accidentally hits return it will not return a null value. btw, my notes to enable a cancel button: Put this after every dialog and replace variable with the dialog variable If variable = "" Then Exit Sub Else End If Hope that helps |
|
#3
|
||||
|
||||
|
Hello Wes,
Currently Dialog.Prompt does not return the value of which button was pressed so you cannot tell in a direct way. I've added your post to our request database and if Dialog.Prompt offers a direct way to know which button was clicked in a future release of SecureCRT, we'll post a follow up message here. Let us know if you'd like to be notified via e-mail should this be added, and please refer to forum 5079. There are a couple of possible workarounds:
Code:
Alternatively, you may want to use the Internet Explorer object to build a custom dialog. This could be preferable if there are many fields of data to enter. The SecureCRT Scripting Manual section 6.3 discusses Building Custom Dialogs or Forms. Do you think either of these ideas will help serve as a workaround? Last edited by miked : 03-05-2010 at 03:53 PM. |
|
#4
|
|||
|
|||
|
Thanks Michael and cr1275,
In this case I do pre-fill the most common value, so I was just hoping the users could hit delete and then OK, but I guess not. I could go with the IE dialog, but I don't think I want to put that much into this script, at least not at this time. I will probably go with a keyword like "Enter 'All' to get a full list". This shouldn't be too hard and fairly obvious. Wes |
|
#5
|
|||
|
|||
|
Not sure what the script does. However, you may be able to use CASE instead of the if ?
|
|
#6
|
|||
|
|||
|
Nah, not in this 'case'...
It's really just used as a filter for a large directory listing. Entering nothing would give the whole directory, entering for example ab would give all files starting with ab.Wes |
|
#7
|
|||
|
|||
|
Thanks,
I ended up keeping the portion of code to treat a null string as a cancel and added a prompt for the user to enter "all" for the full list. Wes |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|