Michael36 0 Report post Posted November 10, 2005 Hi all i'm having a hard time puting the text of a txt file into a editbox i try'd to put this code into a loop but it jsut keeps adding the first like i would like to put a txt file into a edit i'm not sure what i'm doing Wrong any ideas on how i could do this ? thank you Michael $file = FileOpen("test.txt", 0) $ch = FileReadline($file, 1) GUICtrlRead($Edit,GUICtrlSetData(-1,$ch)& @LF ) FileClose($ch) Share this post Link to post Share on other sites
Zedna 166 Report post Posted November 10, 2005 (edited) Try something like this: $txt = FileRead($file_name, FileGetSize($file_name)) GUICtrlSetData($Edit,$txt) Edited November 10, 2005 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Share this post Link to post Share on other sites
Michael36 0 Report post Posted November 10, 2005 Try something like this:$txt = FileRead($file_name, FileGetSize($file_name)) GUICtrlSetData($Edit,$txt) thank you for your help your example did not work for me but i did get it to work like this $file= FileOpen("test.txt", 0) $txt = FileRead($file,100000000) GUICtrlSetData($Edit,$txt) FileClose($ch) Share this post Link to post Share on other sites
Zedna 166 Report post Posted November 11, 2005 thank you for your help your example did not work for me but i did get it to work like this $file= FileOpen("test.txt", 0) $txt = FileRead($file,100000000) GUICtrlSetData($Edit,$txt) FileClose($ch)I expected, you put name of file into variable $file_name:$file_name = "test.txt" $txt = FileRead($file_name, FileGetSize($file_name)) GUICtrlSetData($Edit,$txt)OR$txt = FileRead("test.txt", FileGetSize("test.txt")) GUICtrlSetData($Edit,$txt) Resources UDF ResourcesEx UDF AutoIt Forum Search Share this post Link to post Share on other sites
Michael36 0 Report post Posted November 11, 2005 I expected, you put name of file into variable $file_name:$file_name = "test.txt" $txt = FileRead($file_name, FileGetSize($file_name)) GUICtrlSetData($Edit,$txt)OR$txt = FileRead("test.txt", FileGetSize("test.txt")) GUICtrlSetData($Edit,$txt)ok thank you i understand now i was wondering where you got the $file_name var from hehehehei understand what you mean thank you ! Share this post Link to post Share on other sites
JSThePatriot 11 Report post Posted November 11, 2005 ok thank you i understand now i was wondering where you got the $file_name var from hehehehei understand what you mean thank you !Just a quick note. A better programming practice is to follow the advice of the FileGetSize() function as your size to read, because eventually the file may exceed your reading abilities. It is just safer and a better programming practice. I just wanted to mention that, incase you havent already added it to your working script.JS AutoIt LinksFile-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.ComputerGetInfo UDF's Updated! 11-23-2006External LinksVortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Share this post Link to post Share on other sites
Michael36 0 Report post Posted November 11, 2005 Just a quick note. A better programming practice is to follow the advice of the FileGetSize() function as your size to read, because eventually the file may exceed your reading abilities. It is just safer and a better programming practice. I just wanted to mention that, incase you havent already added it to your working script.JS ok thank you for the advice i will do that it's a very good point Share this post Link to post Share on other sites