Shinies Posted October 3, 2005 Posted October 3, 2005 Hey, i have been trying to get the text inside a .txt file, and storing it into a $var. I was using this code to test if it would work $fileread = FileOpen("123.txt", 0) If $fileread = -1 Then Exit EndIf While 1 $txt = FileRead($fileread, 1) If @error = -1 Then ExitLoop Wend FileClose($fileread) Run("Notepad.exe") WinWaitActive("Untitled - Notepad") Send($txt) But all it writes to the notepad is "ΒΌ" ..? is there another function i can use to accomplish this? or is there another way to do this? plz help thanks -Smirk
sykes Posted October 3, 2005 Posted October 3, 2005 Try The Following: $file = FileOpen("test.txt", 0) $cnt = FileGetSize("Test.txt") If $file = -1 Then Exit EndIf $txt = FileRead($file, $cnt) ClipPut($txt) FileClose($file) Run("Notepad.exe") WinWaitActive("Untitled - Notepad") ;Send($txt);Uncomment this line to send the text one character at a time ;Send("^v");Uncomment this line to paste the text into notepad all at once We have enough youth. How about a fountain of SMART?
w0uter Posted October 3, 2005 Posted October 3, 2005 why not just use $txt = FileRead('test.txt', FileGetSize('test.txt')) If @error then Exit clipput($txt) My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll
jefhal Posted October 3, 2005 Posted October 3, 2005 why not just use$txt = FileRead('test.txt', FileGetSize('test.txt'))If @error then Exitclipput($txt)and... if you'd like to read just one line at a time, check out: FileReadLine ( filehandle or "filename" [, line] ) ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Shinies Posted October 4, 2005 Author Posted October 4, 2005 The first one worked perfectly, i spose where i went wrong was not getting the file size? anyways, thank you so much for your help -Smirk
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