Jump to content

Exit the script if user input is null - Please assist


mohan93
 Share

Recommended Posts

Hello Everyone,

Am struck with the below scenario, 

$EXEpath = FileOpenDialog('Please choose any file', '', 'All (*.*)', 1)  ---> This will open a window to select for a file. 

if $EXEpath <> 0 Then     (This Not equal to is not working)

       ;;"User has selected a file, Continue with script"

Else

     ;;"User did not select any file, exiting"

EndIf

 

If user does not select any file and clicks on cancel after the opening Choose a file dialog (please refer the attachment) my script should exit else have to proceed with scripting

Please help.

post-80414-0-37233500-1385001463_thumb.j

Link to comment
Share on other sites

try this

if Not $EXEpath = 0 Then

or.... From the help file.

Local $message = "Hold down Ctrl or Shift to choose multiple files."

Local $var = FileOpenDialog($message, @WindowsDir & "\", "Images (*.jpg;*.bmp)", 1 + 4)

If @error Then
    MsgBox(4096, "", "No File(s) chosen")
Else
    $var = StringReplace($var, "|", @CRLF)
    MsgBox(4096, "", "You chose " & $var)
EndIf
Edited by NewPlaza
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...