gbr Posted December 22, 2011 Share Posted December 22, 2011 Hi All:I am trying to automate a flashing procedure in target. I am sending commands via a console and taking logs in a text file. I am reading the text file and once I get the success message of the first command, I send the second command.But its not working Below is the code snippet of the function that checks for the success message.Func FlashCheck() sleep(60000) $vValue2 = "SUCCESS: flashing finished!" Do $chars2 = FileReadLine($file) $Search2 = StringInStr ( $chars2, $vValue2) If @error = -1 Then ExitLoop Until $Search2 > 0 Send("{ENTER}")EndFuncI am calling this function Flashcheck after the first command as below in the main program:Send("1st command")Send("{ENTER}")$Search2 = 0FlashCheck()Send("{ENTER}")Send("2nd Command")Could you please let me know where is it going wrong? Link to comment Share on other sites More sharing options...
JohnOne Posted December 22, 2011 Share Posted December 22, 2011 I'd start by taking a look at the @error values set by StringInStr() function, and comparing themto what you have in your code. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
gbr Posted December 22, 2011 Author Share Posted December 22, 2011 Hi ,If I use the Msg Box.. then I see that all the lines are read from the log.Func FlashCheck()sleep(60000)$vValue2 = "SUCCESS: flashing finished!"Do$chars2 = FileReadLine($file)MsgBox(0, "Check", $chars2)$Search2 = StringInStr ( $chars2, $vValue2)If @error = -1 Then ExitLoopUntil $Search2 > 0Send("{ENTER}")EndFunc If I keep on Clicking OK..once it matches the string to be searched in the line.. it sends the next command... Link to comment Share on other sites More sharing options...
JohnOne Posted December 22, 2011 Share Posted December 22, 2011 Well that's a lovely story, and thanks for sharing. Did you take notice of what I wrote on the first reply I made? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
kylomas Posted December 22, 2011 Share Posted December 22, 2011 (edited) gbr, But its not working is not a description of the problem... One thing that I would check just looking at these two functions is the scope of $Search2. It appears that you are counting on it retaining it's value from function to function... For further help post all of the code or a representative reproducer. Good Luck, kylomas Edited December 22, 2011 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
JohnOne Posted December 22, 2011 Share Posted December 22, 2011 Actually, in lieu of the OP replying I'm going to take a guess at the possible problem. I'm imagining the code has been copy and pasted from somewhere and the StringInStr func just thrown in after. So Move your @error check for -1 to immediately after the call to FileReadLine. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
kylomas Posted December 22, 2011 Share Posted December 22, 2011 j1, yea, w/o code kinda hard to tell !! kylomasw Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill 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