catstwespos Posted November 29, 2006 Posted November 29, 2006 Hey, i have been working on automating some installs using this software (makes things a TON easier!) but i need more information on if the install works. i have it set up to save a .log file to inform me if the install is successful or errors, but i am having problems with searching that file for the text. i have tried using wingettext and controlgettext but neither have worked for me. here is a copy of my code, if anyone could help me with this part that would be great! $file = FileOpen("install.log", 0) If $file = -1 Then MsgBox(0,"Error", "File Not Found") Exit ElseIf WinGetText("install - Notepad", "Error:") Then MsgBox(0, "Error", "Error in Installation!") ElseIf WinGetText("install - Notepad", "Operation Complete",) Then MsgBox(0, "Install Complete", "Installation Completed Successfully!") Else MsgBox(0, "Error", "Cannot Read File!") EndIf FileClose($file)
Xenobiologist Posted November 29, 2006 Posted November 29, 2006 Hi, maybe have a look at WinWaitActive and so on. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
Valuater Posted November 29, 2006 Posted November 29, 2006 (edited) Welcome to the Autoit Forums!!! maybe.. #include <file.au3> Dim $aRecords If Not _FileReadToArray("install.log", $aRecords) Then MsgBox(4096, "Error", " Error reading log to Array error:" & @error) Exit EndIf For $x = 1 To $aRecords[0] If StringInStr($aRecords[$x], "error") Then MsgBox(0, "Error", 'Record:' & $x & @CRLF & $aRecords[$x]) ExitLoop ElseIf StringInStr($aRecords[$x], "Complete") Then MsgBox(0, "Complete", 'Record:' & $x & @CRLF & $aRecords[$x]) ExitLoop EndIf Next oÝ÷ ÚÚ¢w¥w«jëh×6 If StringInStr(Fileread("install.log"), "error") Then MsgBox(0, "Error", "Error in Installation!") depends on how many lines and how many "error" or "complete" words are in the file 8) Edited November 29, 2006 by Valuater
catstwespos Posted November 29, 2006 Author Posted November 29, 2006 wow! Valuater, your code works AWESOME! I thought i was going to give up! i even already made a vbscript to do the same job, but yours does it sooo much nicer! Thanks a TON!
Xenobiologist Posted November 29, 2006 Posted November 29, 2006 Now I got, what you wanted. :"> Sorry, totally missed the point. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
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