BlazerV60 Posted December 4, 2009 Share Posted December 4, 2009 $file = FileOpen("C:\Users\Brian\Documents\hamster.txt", 4) ;4 is so it reads from directory ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf While 1 $chars = FileRead($file, 1) If @error = -1 Then ExitLoop MsgBox(0, "Char read:", $chars) Wend FileClose($file) When it opens my text, it reads each letter as hex. So instead of it displaying "Hamsters are cute" it displays the hex of it. How do I make it read the letters instead. And can I make it so that if I put a autoit code in that text, then it executes that autoit code? Link to comment Share on other sites More sharing options...
Developers Jos Posted December 4, 2009 Developers Share Posted December 4, 2009 Why are you using filemode 4 in the FileOpen()? (4 = Read raw mode) 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...
BlazerV60 Posted December 4, 2009 Author Share Posted December 4, 2009 (edited) Why are you using filemode 4 in the FileOpen()? (4 = Read raw mode) Oh, I tried very hard to avoid using 4 because when I do: $file = FileOpen("Hamster.txt", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf While 1 $chars = FileRead($file, 1) If @error = -1 Then ExitLoop MsgBox(0, "Char read:", $chars) Wend FileClose($file) It can't find my file D=. I guess its cause it doesn't know which directory to look for it in idk. Its my first time using fileopen =p Edited December 4, 2009 by BlazerV60 Link to comment Share on other sites More sharing options...
skyboy Posted December 4, 2009 Share Posted December 4, 2009 if the path is like it is in your second example, it checks the current directory, then it checks the PATH environment variable if the path starts with a drive, it is total absolute and looks only there if the path starts with "/" it is mostly absolute and looks only on the current drive if the path starts with "./" it is relative and only looks in that directory if the path starts with "../" it starts in the parent directory just copy the path from the first example to the second example and it'll work just fine Link to comment Share on other sites More sharing options...
BlazerV60 Posted December 4, 2009 Author Share Posted December 4, 2009 (edited) if the path is like it is in your second example, it checks the current directory, then it checks the PATH environment variableif the path starts with a drive, it is total absolute and looks only thereif the path starts with "/" it is mostly absolute and looks only on the current driveif the path starts with "./" it is relative and only looks in that directoryif the path starts with "../" it starts in the parent directoryjust copy the path from the first example to the second example and it'll work just fineOhhh it worked, thanks you guys. And it is it possible for me to use fileopen to open a gui made by autoit. Cause when I make it open my gui program, it just shows me a box with the gui code in it instead of the gui itself. Edited December 4, 2009 by BlazerV60 Link to comment Share on other sites More sharing options...
skyboy Posted December 4, 2009 Share Posted December 4, 2009 a GUI exists in memory, so no; but if you set it to a variable you can reference that variable later in the script Dim $myGUI1 = GUICreate("My GUI!") Dim $myGUI2 = GUICreate("My other GUI!") GUISetState(@SW_SHOWNORMAL, $myGUI1) GUISetState(@SW_SHOWNOACTIVATE, $myGUI2) Link to comment Share on other sites More sharing options...
BlazerV60 Posted December 4, 2009 Author Share Posted December 4, 2009 (edited) ooo Thanks! Edited December 4, 2009 by BlazerV60 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