Rad Posted January 14, 2006 Share Posted January 14, 2006 Just so you know, memfield is the text area and membtn3 is the "Open" buttonCase $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) EndifNow 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? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 14, 2006 Moderators Share Posted January 14, 2006 (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? 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 January 14, 2006 by SmOke_N 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. Link to comment Share on other sites More sharing options...
Rad Posted January 14, 2006 Author Share Posted January 14, 2006 Its crashing with "invalid file handle used" ?? Link to comment Share on other sites More sharing options...
Valuater Posted January 14, 2006 Share Posted January 14, 2006 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) Link to comment Share on other sites More sharing options...
Developers Jos Posted January 14, 2006 Developers Share Posted January 14, 2006 Which AutotIt version is gving this problem ? Try the Latest BETA to see if the problem still exists. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now