webjocky Posted March 27, 2007 Posted March 27, 2007 (edited) I am trying to have this Function wait until it reads a certain string of characters in the Visible Window Text of a TeamSpeak window - I can't seem to get it working! Here is the output from Active Window Info: >>>>>>>>>>> Visible Window Text <<<<<<<<<<< Server: Servername here Server IP: xxx.xxxxx.com:8769 (xx.xx.xx.xx:8769) Version: 2.0.20.1 Type: Freeware Clan Server Platform: Win32 Welcome Message: Servername goes here Connected as pleaseregisterme [10:16:29] Connecting to xxx.xxxx.com:8767 [10:16:29] Connected to server Servername goes here [10:16:29] Servername goes here [10:16:31] webjocky joined channel [10:16:34] webjocky grants you the right to register with the server Here is my Function: Func OkToReg() ;;;A little time buffer Sleep(2000) ;;;Search for "grants" in the window text $okiedokie = StringInStr("grants",WinGetText("TeamSpeak 2",""),0,1) ;;; If it doesn't find it, try again If $okiedokie = 0 Then OkToReg() ;;; If it finds it, continue the script after error checking ElseIf $okiedokie <> 0 Then ;;Check for errors $FuncError = "OkToReg" $ExplicitError = @error If @error Then ErrorCheck() EndIf EndFunc I'd appreciate any input! Edited March 27, 2007 by webjocky The tiniest of things can ruin your day, or brighten your afternoon. Read it once, read it again, and pay attention. Then search the forums. If all else fails, ask somebody else.
rush4hire Posted March 27, 2007 Posted March 27, 2007 Did you use the window tool to find out if you can even read the text in that control? ControlGetText ( "Title of Window", "", "TRichEdit1" ) for example.. Decompilable game code manager for Dark Deeds 6 for Warcraft IIIA web broadcast TiVo like thing.. (this example is for 3abn.org)Finally.. AutoIt Pac-Man Digital Hymn Player
webjocky Posted March 27, 2007 Author Posted March 27, 2007 Did you use the window tool to find out if you can even read the text in that control? ControlGetText ( "Title of Window", "", "TRichEdit1" ) for example.. Yes, I actually tried this and successfully recieved the text I'm searching for in the message box: $GimmieSomeText = WinGetText("TeamSpeak 2","") MsgBox(0,"Well. . .",$GimmieSomeText) The tiniest of things can ruin your day, or brighten your afternoon. Read it once, read it again, and pay attention. Then search the forums. If all else fails, ask somebody else.
SadBunny Posted March 27, 2007 Posted March 27, 2007 (edited) Your StringInStr function is off. It should be: $okiedokie = StringInStr(WinGetText("TeamSpeak 2",""),"grants") (The 1st parameter is the string to search IN, the 2nd parameter is the string to search FOR (in the first parameter). See StringInStr help. Also the ,0,1 in the end are both the default settings so you don't need to specify them if you don't want to.) Edited March 27, 2007 by SadBunny Roses are FF0000, violets are 0000FF... All my base are belong to you.
SadBunny Posted March 27, 2007 Posted March 27, 2007 Your StringInStr function is off. It should be: $okiedokie = StringInStr(WinGetText("TeamSpeak 2",""),"grants") (The 1st parameter is the string to search IN, the 2nd parameter is the string to search FOR (in the first parameter). See StringInStr help. Also the ,0,1 in the end are both the default settings so you don't need to specify them if you don't want to.) On top of that, I don't exactly follow your rest of the code, but if this returns 0, it means the string was NOT found! So the okToReg() is executed in your code if the StringInStr fails, meaning the substring "grants" was not found. Is that what you intended? Roses are FF0000, violets are 0000FF... All my base are belong to you.
webjocky Posted March 27, 2007 Author Posted March 27, 2007 On top of that, I don't exactly follow your rest of the code, but if this returns 0, it means the string was NOT found! So the okToReg() is executed in your code if the StringInStr fails, meaning the substring "grants" was not found. Is that what you intended?Yes, this is exactly what it is intended to do.Thank you soooo much sadBunny - I have been up for 30 something hours now - I had the correct syntax sitting right in front of me in the Help files - heck, it was still opened to StringInStr when I sat back down to give it another go - I was just blinded by stupidity & lack of sleep.Thanks for the extra set of eyes. The tiniest of things can ruin your day, or brighten your afternoon. Read it once, read it again, and pay attention. Then search the forums. If all else fails, ask somebody else.
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