Jump to content
Sign in to follow this  

Exit the script if user input is null - Please assist

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"


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



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.


Share this post

Link to post
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")
    $var = StringReplace($var, "|", @CRLF)
    MsgBox(4096, "", "You chose " & $var)
Edited by NewPlaza
  • Like 1

Share this post

Link to post
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

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.