someone Posted December 16, 2008 Share Posted December 16, 2008 Well, it still gives me a 0 in second call ^(((. $MatchText is not an array, but why? Here is a full code: expandcollapse popup$Path = "C:\Documents and Settings\ivanovkv\Рабочий стол\Logs\" $File = "Logfile.txt" $FullPathFile = "C:\Documents and Settings\ivanovkv\Рабочий стол\Logs\Logfile.txt" $time = @hour & "." & @MIN & "." & @SEC $Simpletime = @MDAY & "." & @MON & "." & @YEAR $sFile = $Path & $Simpletime & " - " & $File $CheckWinTitle = WinGetTitle("") CheckForCorrectForm ($CheckWinTitle, "Содержание" & @LF, @LF & "Кол-во листов", "Test 123 Test: test; Test/test? test@test.test, Test", $time & ": Document test = Содержание - Test: ISSUE" & @CRLF , $time & ": Document test = Содержание - Test: OK" & @CRLF ) CheckForCorrectForm ($CheckWinTitle, "Кому(2 из 2)" & @LF, @LF & "Содержание", "Assist", $time & ": Кому(2 из 2) test = - Test: ISSUE" & @CRLF , $time & ": Document test = Кому(2 из 2) - Test: OK" & @CRLF ) Func CheckForCorrectForm($WinTitle, $StartSearch, $EndSearch, $Correct, $TestMessage1, $TestMessage2) If $StartSearch = "Кому(2 из 2)"&@LF Then ControlClick($WinTitle, "", "[CLASS:WindowsForms10.EDIT.app.0.30d38e8; INSTANCE:6]") Sleep (2000) Send("{DOWN}") Sleep (2000) EndIf Local $MatchText, $FindText = WinGetText(WinGetHandle($WinTitle), "") $MatchText = _StringBetween($FindText, $StartSearch, $EndSearch) If IsArray($MatchText) And $MatchText[0] == $Correct Then MsgBox(0, "Active window stats (x,y,width,height):", "Correctly matched" & $MatchText[0]) FileWriteLine($sFile, $TestMessage1 & $MatchText[0]) Return SetError(0, 0, 1) Else MsgBox(0, "Active window stats (x,y,width,height):", "Not Correctly matched" & $MatchText) FileWriteLine($sFile, $TestMessage2 & $MatchText) Return SetError(1, 0, 0) _ArrayDisplay($MatchText) EndIf EndFunc I went back to Robjong's code as a reproducer, but its working for me as well. When you say 'it gives me a 0 in second call', that doesn't absolutely mean it isn't an array. That means it either isn't an array or it doesn't match $correct. It could be as small as an extra white space, or capitalization. Start adding msgboxs and arraydisplays anywhere you can to check the output. Are you sure the code doesn't run the 2nd time or is it the 2nd search that fails? Also in your code, this, Return SetError(1, 0, 0) _ArrayDisplay($MatchText) will never produce an array display because of the return above it. Also, since it might not be an array using arraydisplay doesn't make sense. Can you give a better reproducer? PS This -- WinGetText(WinGetHandle($WinTitle) -- doesn't make sense, change it to WinGetText($WinTitle) While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd 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