Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > Scripting

Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 08-29-2015, 03:50 PM
cjmccormack cjmccormack is offline
Registered User
Join Date: Aug 2015
Posts: 3
Question File Open Dialog - how to determine if user hits 'Cancel'


I'm writing a script for running several show commands pre- and post- switch refresh.

The script does the following:
- Parses the last line of a session to get both the prompt and the hostname, the hostname derived from the prompt
- Using the hostname and date parameters, sets the crt.Session.LogFileName to a custom string that auto-populates the filename in the FileOpenDialog
- Opens a crt.Dialog.FileOpenDialog so the user can select the path and change the filename if needed.

After this is done, logging is enabled, the commands are run, logging is disabled again then the script terminates.

My current issue is I'm not sure how to handle the case where the user selects 'Cancel' in the FileOpenDialog box. I would like the script to terminate at that point, but because I have a filename auto-populated, the return value would only be an empty string if the user actually removed the entire filename. It is far more convenient to have the filename auto-populated so removing that is pretty much out of the question.

Are there any methods of the Dialog class that aren't well documented that I could use? Is there an easy way to handle this I may have just missed?

Many thanks!
Reply With Quote

cancel , dialog , fileopendialog , open , scripting

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 07:56 PM.