cnilsson Posted January 18, 2007 Share Posted January 18, 2007 I'm trying to assign the result of a FileRead function to a variable and then use that variable in the MsgBox function. I want the contents of the variable to be displayed as the "text" parameter but each time I run the script, the message box is blank. Any ideas? Here is my code: $result = FileRead("c:\autoit\checkinstalledfiles.log") -->I want to read the entire contents of the file, only 7 lines. MsgBox(0, "Results", $result) Link to comment Share on other sites More sharing options...
Developers Jos Posted January 18, 2007 Developers Share Posted January 18, 2007 (edited) I'm trying to assign the result of a FileRead function to a variable and then use that variable in the MsgBox function. I want the contents of the variable to be displayed as the "text" parameter but each time I run the script, the message box is blank. Any ideas? Here is my code:$result = FileRead("c:\autoit\checkinstalledfiles.log") -->I want to read the entire contents of the file, only 7 lines.MsgBox(0, "Results", $result)Your logfile is probably using UNICODE characters?You can convert it by doing something like RunWait(@comspec & " /c type c:\autoit\checkinstalledfiles.log > newfile.log")Then read the newfile.log.. Edited January 18, 2007 by JdeB 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...
cnilsson Posted January 18, 2007 Author Share Posted January 18, 2007 Your logfile is probably using UNICODE characters?You can convert it by doing something like RunWait(@comspec & " /c type c:\autoit\checkinstalledfiles.log > newfile.log")Then read the newfile.log..Ok, I'll give that a try. Thanks! Link to comment Share on other sites More sharing options...
_Kurt Posted January 18, 2007 Share Posted January 18, 2007 Perhaps you are looking for something like this: $Result = FileReadLine("FileHere.txt", 1) Msgbox(0,"",$Result) (UNTESTED) Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
FitzChivalry Posted January 18, 2007 Share Posted January 18, 2007 also try Msgbox(0,"Results"," " & $Result) i think you might need the ampersand to include a variable... not absolutly sure though Link to comment Share on other sites More sharing options...
_Kurt Posted January 19, 2007 Share Posted January 19, 2007 Nah, my way works perfectly fine, just be sure to have a correct readable path. Kurt Awaiting Diablo III.. 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