Search the Community
Showing results for tags 'text search'.
-
Hi all, i am working with company internal web page, where i am getting warnings for IE functions since the declared object will become invalid. i want to count the text "NEW" in a web page. Screenshot is attached. Please help me on this. the below code is not working since i can't declare the page as an object. (i will be routed to this page through some other links) $sText = _IEBodyReadText($oIE)
-
Hi guys I have 3 txt files, and the script searches them, to find the txt file containing my username. If found in one of the txt files, an msgbox will tell which txtfile my username was found in. Works fine. ;\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ Global $Text[3] ;If changed, remember to change multiple places in the script. $Text[0] = ("01_TextFile") $Text[1] = ("02_TextFile") $Text[2] = ("03_TextFile") Global $DirforTxtFiles = "C:\Temp\" $username = @UserName ;pulls username that is logged in ;\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ ; SCRIPT START For $i = 0 to 3 - 1 $TextFile = FileOpen($DirforTxtFiles & $Text[$i] & ".txt", 0) $ReadText = FileRead($TextFile) FileClose($TextFile) If StringRegExp($ReadText, $username) Then Call("MainScript") EndIf Next Func MainScript() MsgBox(0,"USER FOUND", "In following textfile: " & $Text[$i]) EndFunc But now I want the script to do something else, if my username is NOT found in any of the txtfiles The following example below here doesn't work, since the Else statement is placed inside the For loop, So it will run the Else statement, every time the StringRegExp doesn't find my username in a txtfile. ;\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ Global $Text[3] ;If changed, remember to change multiple places in the script. $Text[0] = ("01_TextFile") $Text[1] = ("02_TextFile") $Text[2] = ("03_TextFile") Global $DirforTxtFiles = "C:\Temp\" $username = @UserName ;pulls username that is logged in ;\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ ; SCRIPT START For $i = 0 to 3 - 1 $TextFile = FileOpen($DirforTxtFiles & $Text[$i] & ".txt", 0) $ReadText = FileRead($TextFile) FileClose($TextFile) If StringRegExp($ReadText, $username) Then Call("MainScript") Else Call("NotInTextFile") EndIf Next Func MainScript() MsgBox(0,"USER FOUND", "In following textfile: " & $Text[$i]) EndFunc ;\/___________________________________________________________________________\/ Func NotInTextFile() MsgBox(0,"", "USER NOT IN ANY TEXTFILE") EndFunc What it SHOULD do, is search the txtfiles for my username, and then when all the searching is done, it should react based on the search result. The answer might be quite obvious, but I'm stuck at this point. Any ideas would be much appreciated