flaxcrack Posted February 13, 2006 Share Posted February 13, 2006 Hey guys any ideas why this wouldn't be writing to the file and making files on my desktop. It is so strange because the file on my desktop is 0 and every time you press the 0 key it writes 0 to file named 0 and not to logfile.txt. Any help would be great. #Include <Misc.au3> #include <File.au3> $dll = DllOpen("user32.dll") $LineReturn = 1 $Logfile = "C:\logfile.txt" IF Not FileExists($Logfile) Then _FileCreate($Logfile) FileOpen($Logfile, 2) While 1 $Line = FileReadLine($Logfile, $LineReturn) If _IsPressed("0D", $dll) Then $LineReturn = $LineReturn + 1 If _IsPressed("08", $dll) Then FileWriteLine(StringRight($Line, 1), $LineReturn) If _IsPressed("20", $dll) Then FileWriteLine($Line & " ", $LineReturn) If _IsPressed("30", $dll) Then FileWriteLine($Line & "0", $LineReturn) Sleep(1) WEnd FileClose($Logfile) DllClose($dll) [quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD() Link to comment Share on other sites More sharing options...
Valuater Posted February 13, 2006 Share Posted February 13, 2006 (edited) this is your open the file for writing FileOpen($Logfile, 2) then the next line you are reading with $Line = FileReadLine($Logfile, $LineReturn) that could create errors 8) Edited February 13, 2006 by Valuater Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 13, 2006 Moderators Share Posted February 13, 2006 FileWriteLine ( filehandle or "filename", "line" ) 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...
flaxcrack Posted February 13, 2006 Author Share Posted February 13, 2006 that could create errors8)What does that mean? [quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD() Link to comment Share on other sites More sharing options...
flaxcrack Posted February 13, 2006 Author Share Posted February 13, 2006 FileWriteLine ( filehandle or "filename", "line" )Speak in english not code please. [quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD() Link to comment Share on other sites More sharing options...
Valuater Posted February 13, 2006 Share Posted February 13, 2006 (edited) Simply... you are opening the file to write to it with the #2... then you try to "Read" from that file... that is incorrect.. SmOke has showed you filewrite line to correct the error 8) Edited February 13, 2006 by Valuater Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 13, 2006 Moderators Share Posted February 13, 2006 #Include <Misc.au3> #include <File.au3> $dll = DllOpen("user32.dll") $LineReturn = 1 $Logfile = "C:\logfile.txt" IF Not FileExists($Logfile) Then _FileCreate($Logfile) $FileOpenLog = FileOpen($Logfile, 2) While 1 $Line = FileReadLine($Logfile, $LineReturn) If _IsPressed("0D", $dll) Then $LineReturn = $LineReturn + 1 If _IsPressed("08", $dll) Then FileWriteLine('FileYouWillBeWritingTo', StringRight($Line, 1)) If _IsPressed("20", $dll) Then FileWriteLine('FileYouWillBeWritingTo', $Line & ' ') If _IsPressed("30", $dll) Then FileWriteLine('FileYouWillBeWritingTo', $Line & "0") Sleep(1) WEnd FileClose($FileOpenLog) DllClose($dll)It was english, straight out of the help file. 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...
seandisanti Posted February 13, 2006 Share Posted February 13, 2006 Speak in english not code please. he was quoting the helpfile. you're calling FileWriteLine() without passing a filename to tell it where to write. so instead of writing to the file you want, it's interpretting your line to be the file name. Link to comment Share on other sites More sharing options...
flaxcrack Posted February 13, 2006 Author Share Posted February 13, 2006 #Include <Misc.au3> #include <File.au3> $dll = DllOpen("user32.dll") $LineReturn = 1 $Logfile = "C:\logfile.txt" IF Not FileExists($Logfile) Then _FileCreate($Logfile) $FileOpenLog = FileOpen($Logfile, 2) While 1 $Line = FileReadLine($Logfile, $LineReturn) If _IsPressed("0D", $dll) Then $LineReturn = $LineReturn + 1 If _IsPressed("08", $dll) Then FileWriteLine('FileYouWillBeWritingTo', StringRight($Line, 1)) If _IsPressed("20", $dll) Then FileWriteLine('FileYouWillBeWritingTo', $Line & ' ') If _IsPressed("30", $dll) Then FileWriteLine('FileYouWillBeWritingTo', $Line & "0") Sleep(1) WEnd FileClose($FileOpenLog) DllClose($dll)It was english, straight out of the help file. So so sorry. I have given up caffin and I am suffering horably... WTF was I thinking. Sorry about that mate. [quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD() 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