aromo Posted January 4, 2007 Posted January 4, 2007 MY CODE:$tmpDrive = DriveMapAdd("*", "\\MYSERVER\myshare$", 0)MsgBox(0,"Result", "DriveMapadd result = " & $tmpDrive ) ; debug line$bkpLogFile = FileOpen( $tmpDrive & "\backup.log", 0) ; this is a plain text fileMsgBox(0,"Result","$bkpLogFile handle = " & $bkpLogFile) ; debug line (always 1 even if the file does not exist)While 1 $bkpLogLine = FileReadLine ( $bkpLogFile ) If @error = -1 then ExitLoop msgbox(0, "Line " , "[" & $bkpLogLine & "]" )WEndFileClose ( $bkpLogFile)DriveMapDel( $tmpDrive )WHAT I'VE DONE:1. even if the file doesn't exist, $bkpLogFile returns 12. If I copy the file locally and then open the local file, it works fine3. I upgraded to AutoIT 3.2.2.04. I run TYPE \\MYSERVER\myshare$\backup.log and it shows fineTHE PROBLEM:Since the FileOpen returns 1, I end up in an infinite loop reading garbage on the the first line and then nulls. I need to read the actual content of the file (as shown by TYPE).Thank you. [size="3"][font="Verdana"]Doing more with less!![/font][/size]
Billy Posted January 4, 2007 Posted January 4, 2007 Using V3.2.2.0, I get nearly the same results using your script except that "$bkpLogFile = FileOpen( $tmpDrive & "\backup.log", 0)" returns -1 for me. Regardless of the return value, your code has no conditional to bypass the read when the file is not found, such as: If $bkpLogFile <> -1 Then While 1 $bkpLogLine = FileReadLine ( $bkpLogFile ) If @error = -1 then ExitLoop msgbox(0, "Line " , "[" & $bkpLogLine & "]" ) WEnd EndIf Are you certain of a return value of 1?
aromo Posted January 5, 2007 Author Posted January 5, 2007 (edited) Billy said: Using V3.2.2.0, I get nearly the same results using your script except that "$bkpLogFile = FileOpen( $tmpDrive & "\backup.log", 0)" returns -1 for me. Regardless of the return value, your code has no conditional to bypass the read when the file is not found, such as: If $bkpLogFile <> -1 Then While 1 $bkpLogLine = FileReadLine ( $bkpLogFile ) If @error = -1 then ExitLoop msgbox(0, "Line " , "[" & $bkpLogLine & "]" ) WEnd EndIf Are you certain of a return value of 1? Thank you for your reply Billy. It must be after I upgraded to 3.2 that it's returning -1 if the file doesn't exist. Anyhow, the main issue here is how to read the content of the file? NEW INFO: When I read local files it works fine. When I copy the remote file and try to open it locally, it has the same problem. Both systems are Windows and I can TYPE the file from CMD. I have admin rights in both systems. Edited January 5, 2007 by aromo [size="3"][font="Verdana"]Doing more with less!![/font][/size]
Billy Posted January 5, 2007 Posted January 5, 2007 I would also check to see that the file does not exist at all. If it's a zero-byte file, both your code and mine will "work". You can report a bug, but there is more information needed. Since we are both using v3.2.2.0, you must consider what is different in your environment from mine (and others). For comparison sake, my environment is:Windows XP (Professional) Service Pack 2Kernel Version 5.1.2600.2622Windows NetworkDomain Controller = Windows 2000 Service Pack 4My user account is in the Domain Admins group (could you have a rights problem?)
aromo Posted January 5, 2007 Author Posted January 5, 2007 I think I got what's going on.. I read the file with a Perl script and this is how it looks like: ഊB a c k u p S t a t u s O p e r a t i o n : B a c k u p D e s t i n a t i o n : 4 m m D D S ... you get the idea. Now my problem is different. Thank you. [size="3"][font="Verdana"]Doing more with less!![/font][/size]
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