Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-28-2014, 12:46 PM
Ka0sFact)r Ka0sFact)r is offline
Registered User
 
Join Date: Feb 2014
Posts: 2
check for valid file

I am working on a script that I almost have completed. However I am trying to add a fail-safe that will prevent a runtime error. My script for SecureCRT is written in vb. At the start of the script the user is to select a .csv file that will be read into an array for the script to use. I want to have the script check to make sure that the user entered a file, did not select cancel, and the file is a .csv file and not some other file type. If it is not a valid csv file I want to give the option to retry or abort the script.

Here is all I have that is working so far:

filepath = crt.Dialog.FileOpenDialog("Please select the *.csv file to open")
If FileSysObj.GetExtensionName(filepath) = "csv" <> False Then
crt.Dialog.MessageBox _
"The selected file is not a valid csv file!" & vbCrLf & _
"Please choose a valid csv file!" & vbCrLf & _
End If


However if the don't select a valid file the script tries to proceed and just crashes.
Reply With Quote
 

Tags
file calling , file types , securecrt , vbscript

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 08:58 PM.