Sign in to follow this  
Followers 0
Rad

Crash after loading while loaded?...

5 posts in this topic

Just so you know, memfield is the text area and membtn3 is the "Open" button

Case $msg = $mem_btn3
        $backup=GUICtrlRead($mem_field)
        GUICtrlSetData($mem_field,"")
        $file=FileOpenDialog("Import Trigger Data", @DesktopDir, "Text files (*.txt)",1)
        If @error <> 1 Then 
            GUICtrlSetData($mem_field,FileRead($file,1024))
        Else
            GUICtrlSetData($mem_field,$backup)
        Endif

Now for some strange reason the first time you load it works like a charm, the second time you can load but you have to be VERY quick. If you hover your mouse on a .txt file at the preloaded directory, it will get probrably to where the little box pops up saying the program name/type/size... then BAM my program crashes.

Any reason why? :lmao:

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Just so you know, memfield is the text area and membtn3 is the "Open" button

Case $msg = $mem_btn3
        $backup=GUICtrlRead($mem_field)
        GUICtrlSetData($mem_field,"")
        $file=FileOpenDialog("Import Trigger Data", @DesktopDir, "Text files (*.txt)",1)
        If @error <> 1 Then 
            GUICtrlSetData($mem_field,FileRead($file,1024))
        Else
            GUICtrlSetData($mem_field,$backup)
        Endif

Now for some strange reason the first time you load it works like a charm, the second time you can load but you have to be VERY quick. If you hover your mouse on a .txt file at the preloaded directory, it will get probrably to where the little box pops up saying the program name/type/size... then BAM my program crashes.

Any reason why? :lmao:

Did you try Clearing $file like you did the $mem_field to see if that worked?

Case $msg = $mem_btn3
        $backup=GUICtrlRead($mem_field)
        GUICtrlSetData($mem_field,"")
        $file = ''
        $file=FileOpenDialog("Import Trigger Data", @DesktopDir, "Text files (*.txt)",1)
        If @error <> 1 Then 
            GUICtrlSetData($mem_field,FileRead($file,1024))
            FileClose($file)
        Else
            GUICtrlSetData($mem_field,$backup)
        Endif

Edit: Just noticed you were using FileRead()... Are you closing the file at all?

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Its crashing with "invalid file handle used" ??

Share this post


Link to post
Share on other sites

maybe try this

Case $msg = $mem_btn3
    $backup = GUICtrlRead($mem_field)
    GUICtrlSetData($mem_field, "")
    $file = FileOpenDialog("Import Trigger Data", @DesktopDir, "Text files (*.txt)", 1)
    If @error <> 1 Then
        GUICtrlSetData($mem_field, FileRead($file, FileGetSize($file)))
    Else
        GUICtrlSetData($mem_field, $backup)
    EndIf

8)


NEWHeader1.png

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