kristoff Posted September 3, 2004 Posted September 3, 2004 Hi gang, I'm beat stuck with this. During soft installation, I 've added a sleep, but sometimes the sleep value is not enough. So I thought than testing if a line is present in a report log file. Report file use ini format. I was looking for a soltuion wich test if the line 9 (last one ) is here or not, whatever the result ( 0 is ok 1 :"> not good ). So I wrote a script with $returncode = iniread($setuplog,"ResponseResult","ResultCode","") and if the $returncode value is empty then loop. Problem is cannot exit from the loop Any experience or clue .... cheers mates
ezzetabi Posted September 3, 2004 Posted September 3, 2004 (edited) Is your log a standard ini file with this shape? Filename equal to $setuplog [ResponseResult] ResultCode=0 or [ResponseResult] ResultCode=1 If it is not, this is your problem Also: maybe the program keep the .log file open? And so Autoit cant access it? Since you know that the line is always the 9th you can try: $returncode = 'ResultCode=1' While $returncode = 'ResultCode=1';It will leave when the line change. $returncode = FileReadLine($setuplog,9) Sleep(1000) WEnd Edited September 3, 2004 by ezzetabi
kristoff Posted September 3, 2004 Author Posted September 3, 2004 Is your log a standard ini file with this shape? Filename equal to $setuplog [ResponseResult] ResultCode=0 or [ResponseResult] ResultCode=1 If it is not, this is your problem Also: maybe the program keep the .log file open? And so Autoit cant access it? Since you know that the line is always the 9th you can try: $returncode = 'ResultCode=1' While $returncode = 'ResultCode=1';It will leave when the line change. $returncode = FileReadLine($setuplog,9) Sleep(1000) WEnd <{POST_SNAPBACK}>Well in fact I don't mind about the results at this stage, just want to check if the line 9 is here or not. Thanks for point me on file is open by the setup process ;-)
kristoff Posted September 3, 2004 Author Posted September 3, 2004 I have no problem check return value by application , I do this later in the script. I don't want to use a sleep, because the installation duration depend on hardware performance, so I would prefer using a loop to test if line 9 is here or not which means installation is over or not. I check later in my script the return value. cheers
ezzetabi Posted September 3, 2004 Posted September 3, 2004 If it enough knowing if the line is there or not just use: While 1 FileReadLine($returncode,9) If not @error Then Exitloop Sleep(1000) WEnd
kristoff Posted September 3, 2004 Author Posted September 3, 2004 here's my script: Opt("TrayIconDebug", 1) ;0=no info, 1=debug line info Opt("TrayIconHide", 0) ;0=show, 1=hide tray icon $setuplog = ("setup.log") $line_code = 9 ;$file = FileOpen($setuplog, 0) ;MsgBox(0, "....FILE....", $setuplog) $returncode = iniread($setuplog,"ResponseResult","ResultCode","") MsgBox(0, "....FILE....", $returncode) While 1 FileReadLine($returncode,$line_code) If not @error Then Exitloop MsgBox(0, "....RESULT CODE....", "the valut NOT exist") Sleep(300) WEnd MsgBox(0, "....RESULT CODE....", "THE VALUE EXIST") exit Well, this a loop of death, infinite, even when I update the source file and save of course. Please help I'm stuck ;-)
ezzetabi Posted September 3, 2004 Posted September 3, 2004 you are trying the read the $returncode as it were a file in FileReadLine() ... Sound strange.
kristoff Posted September 3, 2004 Author Posted September 3, 2004 you are trying the read the $returncode as it were a file in FileReadLine() ... Sound strange. <{POST_SNAPBACK}>oooppsss !!Right, I made so many tries and let piece of code :"> I removed the fileradline ;-)
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