trashy

FileOpenDialog @error

3 posts in this topic

#1 ·  Posted (edited)

Never had anything like this happen before. Tried to open a driver inf file that was corrupt and the whole thing crashed!

$of_T9Button4 = FileOpenDialog("Select Driver Inf", GUICtrlRead($T9Input1), "Inf Files (*.inf)", 1, "")

Tried If @error Then Return     also tried a msgbox still crashed

Exit code : 1 but not showing any errors

Edited by trashy

Share this post


Link to post
Share on other sites



#2 ·  Posted

The FileOpenDialog only returns the path to the file you select, i.e. <FilePath>\filename.inf, there is no error checking on the file itself as far as I'm aware, except for the flags i.e. only if file exists, so the error has to be coming from somewhere else are you able to post more of your script?

Share this post


Link to post
Share on other sites

#3 ·  Posted

I solved the corrupt inf file problem.

Now something very odd with the Recursive file search process you wrote for me.

Just stopped by to update both threads

Case $T9Button4
            $of_T9Button4 = FileOpenDialog("Select Driver Inf", GUICtrlRead($T9Input1), "Inf Files (*.inf)", 1, "")
            GUICtrlSetData($T9Input3, $of_T9Button4)
            If GUICtrlRead($T9Input3) = "" Then
                Return
            Else
                $file = GUICtrlRead($T9Input3)
                $text = FileRead($file)
                $entry1 = _StringBetween($text, "[VERSION]", "[")
                $entry2 = _StringBetween($text, "[Manufacturer]", "[")
                If @error Then
                    MsgBox($MB_SYSTEMMODAL, "", "The driver inf file is not valid.");<<<<this fixed it
                    Return
                EndIf
                GUICtrlSetData($T9Edit2, "Driver Info" & @CRLF & @CRLF & "[Version]" & $entry1[0] & "[Manufacturer]" & $entry2[0])
            EndIf

 

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