Illusion Posted August 28, 2006 Share Posted August 28, 2006 Im totally new with AutoIT so forgive my question if its to easy Im trying to read a specifiek word on some active page. If the word is there then it must return a 1.I have tried it with a simple notepad text file but I can only read the whole page instead of 1 word.Example:winwaitactive("testje - Notepad")$text = WinGetText("testje -", "hallo")MsgBox(0, "Text read was:", $text)This script will give me all the words in the testje.txt but I only need the word hallo.!What am I doing wrong here? Link to comment Share on other sites More sharing options...
Stretch Posted August 28, 2006 Share Posted August 28, 2006 Try using StringInStr to search for a specific word in $text Link to comment Share on other sites More sharing options...
Xenobiologist Posted August 28, 2006 Share Posted August 28, 2006 Hi, $file = FileOpen("test.txt", 0) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf $chars = FileRead($file) FileClose($file) MsgBox(0, "", $chars) If StringInStr($chars, "Hello") <> 0 Then MsgBox(0,"info", "found") 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 Link to comment Share on other sites More sharing options...
Illusion Posted August 28, 2006 Author Share Posted August 28, 2006 Thanx for the reactions: I tried it but I got an error on line 7? I posted the files with it! Link to comment Share on other sites More sharing options...
Xenobiologist Posted August 28, 2006 Share Posted August 28, 2006 HI, sorry I do not get any errors. Works as designed. Can you post the error message, please. 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 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 28, 2006 Moderators Share Posted August 28, 2006 (edited) Instead of this:$file = FileOpen("testje.txt", 0) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf $chars = FileRead($file) FileClose($file) MsgBox(0, "", $chars) If StringInStr($chars, "hallo") <> 0 Then MsgBox(0,"info", "found")oÝ÷ Ø¢é]²)©&Þjëh×6$chars = FileRead("testje.txt") MsgBox(0, "", $chars) If StringInStr($chars, "hallo") Then MsgBox(0,"info", "found")oÝ÷ ØêÞ½éÚºÚ"µÍYÝ[Ò[Ý[TXY ][ÝÝÝK ][ÝÊK ÌÎNÚ[ÉÌÎNÊH[ÙÐÞ ][ÝÚ[É][ÝË ][ÝÙÝ[ ][ÝÊ Edited August 28, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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