Sign in to follow this  
Followers 0
Dead_Man

FileOpenDialog

4 posts in this topic

#1 ·  Posted (edited)

When i open the 2nd FileOpenDialog in this script sometimes it will crash without an error other then "!>18:12:18 AutoIT3.exe ended.rc:-1073741819", what could be causing it?

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("GIF to JPG", 373, 65, 191, 124)
$GIF_InputBox = GUICtrlCreateInput("", 8, 8, 297, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
$JPG_InputBox = GUICtrlCreateInput("", 8, 36, 297, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
$GIF_Button = GUICtrlCreateButton(".GIF", 315, 8, 49, 21, 0)
$JPG_Button = GUICtrlCreateButton(".JPG", 315, 36, 49, 21, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GIF_Button
            $GIF_Location = FileOpenDialog("Select .GIF",@DesktopDir, "GIF Files (*.GIF)",1)
            GUICtrlSetData($GIF_InputBox,$GIF_Location)
        Case $JPG_Button
            $JPG_Location = FileOpenDialog("Select .JPG",@DesktopDir, "JPG Files (*.JPG)",1)
            GUICtrlSetData($JPG_InputBox,$JPG_Location)
    EndSwitch
WEnd
Edited by Dead_Man

Share this post


Link to post
Share on other sites



Try this - NOT TESTED

$g = 0
$j = 0
$Form1 = GUICreate("GIF to JPG", 373, 65, 191, 124)
$GIF_InputBox = GUICtrlCreateInput("", 8, 8, 297, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
$JPG_InputBox = GUICtrlCreateInput("", 8, 36, 297, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
$GIF_Button = GUICtrlCreateButton(".GIF", 315, 8, 49, 21, 0)
$JPG_Button = GUICtrlCreateButton(".JPG", 315, 36, 49, 21, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GIF_Button
            $j = 1
            if $g = 0 then 
                $GIF_Location = FileOpenDialog("Select .GIF",@DesktopDir, "GIF Files (*.GIF)",1)
                GUICtrlSetData($GIF_InputBox,$GIF_Location)
            endif
            $j = 0
        Case $JPG_Button
            $g = 1
            if $j = 0 then 
                $JPG_Location = FileOpenDialog("Select .JPG",@DesktopDir, "JPG Files (*.JPG)",1)
                GUICtrlSetData($JPG_InputBox,$JPG_Location)
            EndIf
            $g = 0
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

That seems to do the trick, I'll post again if it starts happening again, thank

Edited by Dead_Man

Share this post


Link to post
Share on other sites

OK, my last attempt sucked. try this. I tested it and it works fine:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

dim $JPG_Location
dim $GIF_Location
$Form1 = GUICreate("GIF to JPG", 373, 65, 191, 124)
$GIF_InputBox = GUICtrlCreateInput("", 8, 8, 297, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
$JPG_InputBox = GUICtrlCreateInput("", 8, 36, 297, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
$GIF_Button = GUICtrlCreateButton(".GIF", 315, 8, 49, 21, 0)
$JPG_Button = GUICtrlCreateButton(".JPG", 315, 36, 49, 21, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    select 
        Case $nMsg =$GUI_EVENT_CLOSE
            Exit
        Case $nMsg = $GIF_Button 
            GUICtrlSetState($GIF_Button, $GUI_DISABLE)
            GUICtrlSetState($JPG_Button, $GUI_DISABLE)
            $GIF_Location = FileOpenDialog("Select .GIF",@DesktopDir, "GIF Files (*.GIF)",1)
            GUICtrlSetData($GIF_InputBox,$GIF_Location)
            GUICtrlSetState($JPG_Button, $GUI_ENABLE)
            GUICtrlSetState($GIF_Button, $GUI_ENABLE)
        Case $nMsg = $JPG_Button
            GUICtrlSetState($GIF_Button, $GUI_DISABLE)
            GUICtrlSetState($JPG_Button, $GUI_DISABLE)
            $JPG_Location = FileOpenDialog("Select .JPG",@DesktopDir, "JPG Files (*.JPG)",1)
            GUICtrlSetData($JPG_InputBox,$JPG_Location)
            GUICtrlSetState($JPG_Button, $GUI_ENABLE)
            GUICtrlSetState($GIF_Button, $GUI_ENABLE)
        case Else
            ;;;
    EndSelect
WEnd

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