socap Posted January 27, 2012 Share Posted January 27, 2012 #include <String.au3> $Text = FileRead("vz.txt") $Text = _StringBetween($Text, "NEXT", "NEXT") For $i = 0 To UBound($Text) -1 Send("any word") ClipPut($Text[$i]) Send("+{INSERT}") Next Can you please help me in avoiding sending "any word" if text consists ">" symbol between another NEXT's? Mind's boiling. Link to comment Share on other sites More sharing options...
JohnOne Posted January 27, 2012 Share Posted January 27, 2012 If $Text[$i] <> ">" Then Send("any word") EndIf 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...
socap Posted January 27, 2012 Author Share Posted January 27, 2012 (edited) If $Text[$i] <> ">" Then Send("any word") EndIf Thank you very much. I mean, if text is like "word word >word word" it shouldn't send "any word". I can't even test it to know if it works that way. #include <String.au3> $Text = FileRead("test2.txt") $Text = _StringBetween($Text, "NEXT", "NEXT") For $i = 0 To UBound($Text) -1 Sleep(2000) If $Text[$i] <> ">" Then Send("any word") EndIf ClipPut($Text[$i]) Send("+{INSERT}") Sleep (3000) Next Do you know what's wrong? Edited January 27, 2012 by socap Link to comment Share on other sites More sharing options...
hannes08 Posted January 27, 2012 Share Posted January 27, 2012 Hello socap, first of all: read the helpfile. It helps me a lot second: you can use StringInStr() function to see if a ">" string is in the text. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
socap Posted January 27, 2012 Author Share Posted January 27, 2012 (edited) Hello socap, first of all: read the helpfile. It helps me a lot second: you can use StringInStr() function to see if a ">" string is in the text. Thank you very much, I don't understand how exactly make "If Then" line. Can you help? #include <String.au3> $Text = FileRead("test2.txt") $Text = _StringBetween($Text, "NEXT", "NEXT") For $i = 0 To UBound($Text) -1 Sleep(2000) If Stringinstr($Text[$i], ">") <> ">" Then Send("any word") EndIf ClipPut($Text[$i]) Send("+{INSERT}") Sleep (3000) Next Now it sends "any word" only if ">" is alone in text. Can you help that it send "any word" if ">" is anywhere in text? Found the answer to this If Stringinstr($Text[$i], ">") = @Error Then How can I exit the script if $Text[$i] doesn't contain anything please? Edited January 27, 2012 by socap Link to comment Share on other sites More sharing options...
hannes08 Posted January 27, 2012 Share Posted January 27, 2012 Hello socap, The syntax of the IF statement is: If ... Then Else EndIf To exit the script just use the "Exit" statement. And again: Please read the helpfile and/or the tutorials, you can find here in the forum (You may want to look for AutoIT 1-2-3) Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
JohnOne Posted January 27, 2012 Share Posted January 27, 2012 If Not Stringinstr($Text[$i], ">")Then Send("any word") EndIf 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...
socap Posted January 27, 2012 Author Share Posted January 27, 2012 #include <String.au3> $Text = FileRead("test2.txt") $Text = _StringBetween($Text, "NEXT", "NEXT") For $i = 0 To UBound($Text) -1 Sleep(2000) If Stringinstr($Text[$i], ">") = @Error Then Send("any word") EndIf If Stringinstr($Text[$i], "") = "" Then Exit;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ClipPut($Text[$i]) Send("+{INSERT}") Sleep (3000) Next This was supposed to Exit if $Text[$i] doesn't contain anything. But it exits no matter what's inside. Help please. Link to comment Share on other sites More sharing options...
kylomas Posted January 27, 2012 Share Posted January 27, 2012 socap, Can't test without your input file so this is just spitballing... IF you want to test for blank array entries use if stringlen($Text[$i]) = 0 then exit 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...
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