Sign in to follow this  
Followers 0
mohan93

Exit the script if user input is null - Please assist

3 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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
1 person likes this

Share this post


Link to post
Share on other sites

Got it, Thanks NewPlaza :)

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  
Followers 0