lewcamino Posted October 2, 2005 Share Posted October 2, 2005 This seams like a dumb question but I cant seam to get this to work. I want to recognize a window by title and text. The text is 2 lines...and I cant seam to get it to recognize both of them. I tryed... $text = "stuff" & @CR & "next line of stuff" $text = "stuff" & @LF & "next line of stuff" $text = "stuff" & @CRLF & "next line of stuff" winwait ( "title and such" , $text ) I need both cause when there is 1 or the other it is a different window... Any help? Thanx; Lew Link to comment Share on other sites More sharing options...
DoctorX Posted October 2, 2005 Share Posted October 2, 2005 The & CRLF & in any configuration is probably what's messing it up. Try just "stuff" or "stuff next line of stuff". -DRX Link to comment Share on other sites More sharing options...
lewcamino Posted October 2, 2005 Author Share Posted October 2, 2005 Nope no dice. I jsut tryed that. Any other ideas? Link to comment Share on other sites More sharing options...
DoctorX Posted October 2, 2005 Share Posted October 2, 2005 That's all I got... Make sure your variable defs are spelled correctly and double check the window titles and text with the AutoIT Window Info to make sure there aren't any hidden text qualifiers or anything. Other than that, I don't see what could be going wrong. -DRX Link to comment Share on other sites More sharing options...
/dev/null Posted October 2, 2005 Share Posted October 2, 2005 I want to recognize a window by title and text.The text is 2 lines...and I cant seam to get it to recognize both of them.What's the output of "AutoIT Window Info" for that window?CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
lewcamino Posted October 2, 2005 Author Share Posted October 2, 2005 There is an image of it. Thanx again for the help. Link to comment Share on other sites More sharing options...
MHz Posted October 2, 2005 Share Posted October 2, 2005 (edited) The text is 2 lines...and I cant seam to get it to recognize both of them.AutoIt reads form the left and onwards. You do not need to specify the whole line of text. Would not the 1st line do? I have not tried multiline. Not even sure if a second line is valid to use with AutoIt?Edit: From your picture:WinWait ( "iGuidance", "Ready" ) Edited October 2, 2005 by MHz Link to comment Share on other sites More sharing options...
lewcamino Posted October 2, 2005 Author Share Posted October 2, 2005 As I said in my first post. I need both lines cause "ready" and "Guidence" are different windows than "guidence Ready" Link to comment Share on other sites More sharing options...
jefhal Posted October 2, 2005 Share Posted October 2, 2005 As I said in my first post. I need both lines cause "ready" and "Guidence" are different windows than "guidence Ready"Then how about:WinWait ( "iGuidance", "guidance" ) send some commands WinWait ( "iGuidance", "Ready" )The first line will wait until the first dialog box shows up and the second one will wait for the next. Can you tell us what you want to do "between" the two dialog boxes showing up? ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
lewcamino Posted October 2, 2005 Author Share Posted October 2, 2005 You are misunder standing. There are 3 boxes. ( "iGuidance", "guidance" ) ( "iGuidance", "Ready" ) ( "iGuidance", "guidance" & "Ready" ) And they do not appear in order. I need to know when a program changes to ( "iGuidance", "guidance" & "Ready" )...or however I need to write that. So how do I check mutiple text lines? Thanx; Lew Link to comment Share on other sites More sharing options...
jefhal Posted October 2, 2005 Share Posted October 2, 2005 Okay, try this please: Open three copies of Notepad. Do not save the files. Put "Guidance" in one. Put "Ready" in the next. Put "Guidance", ENTER, "Ready" in the third. Be sure there are no spaces at the end of the first line in the last file. (In fact, you will often find hidden spaces in Windows "text". Be careful when trying to match). Run the script. It will find the first window. It will HIDE the window. It will find the second, hide it, and then the third. It will then unhide all three. Somewhere in this melange you should find a way to differentiate between your three open windows. Also, be sure to read the help file on the many options I used, as one allows you to call a window by its "handle" rather than by it's title/text... Opt("WinTitleMatchMode", 3) Opt("WinTextMatchMode", 1) dim $varG, $varGR, $varR if WinExists("Untitled - Notepad","Guidance" & @crlf & "Ready") Then MsgBox(4096,"Found Guidance and Ready","Found Guidance and Ready") $varGR = WinGetHandle("Untitled - Notepad", "Guidance") MsgBox(4096,"Handle of last window was:",$varGR) Opt("WinTitleMatchMode", 3) WinSetState($varGR,"" , @sw_hide) EndIf Opt("WinTitleMatchMode", 3) if WinExists("Untitled - Notepad","Guidance") then MsgBox(4096,"found Guidance","found Guidance") $varG = WinGetHandle("Untitled - Notepad", "Guidance") MsgBox(4096,"Handle of last window was:",$varG) Opt("WinTitleMatchMode", 3) WinSetState("Untitled - Notepad", $varG, @SW_HIDE) EndIf Opt("WinTitleMatchMode", 3) if WinExists("Untitled - Notepad","Ready") then MsgBox(4096,"found Ready","found Ready") $varR = WinGetHandle("Untitled - Notepad", "Ready") MsgBox(4096,"Handle of last window was:",$varR) Opt("WinTitleMatchMode", 3) WinSetState("Untitled - Notepad", $varR, @SW_hide) EndIf WinSetState($varR,"", @SW_SHOW) WinSetState($varG,"", @SW_SHOW) WinSetState($varGR,"", @SW_SHOW) Exit ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
/dev/null Posted October 3, 2005 Share Posted October 3, 2005 There is an image of it. Thanx again for the help.This works for Notepad (as also said in another post).winwait("Untitled - Editor", "Hello World" & @CRLF & "Abc123") msgbox(0,"","Notepad FOUND!!")However, that does not mean it has to work with your application too. It depends on the way your application handles the controls. Try to use WinGetText() on all windows with the same title. Maybe that helps to distinguish them.CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
lewcamino Posted October 3, 2005 Author Share Posted October 3, 2005 (edited) Well I gave up and jsut did this. if winactive("iguidence", "guidence") AND winactive "iguidence", "ready") Then Since they both dotn exist at the same time. Thanx for the help but the notepad thing works fine. However it does not work with the program I am scripting for. Edited October 3, 2005 by lewcamino Link to comment Share on other sites More sharing options...
LxP Posted October 3, 2005 Share Posted October 3, 2005 (edited) The reason it works for Notepad and not for you is that you are searching for one control with the text 'Guidance[LF]Ready', when in fact the window contains two separate controls -- one with 'Guidance' and one with 'Ready'. It isn't possible to find a window containing two separate texts using a single call. Your final solution is the most elegant one. It's a good thing* that you are working with the active window too. Edit: * For code simplicity's sake. Edited October 3, 2005 by LxP Link to comment Share on other sites More sharing options...
lewcamino Posted October 4, 2005 Author Share Posted October 4, 2005 Acctually I miss typed. I am using; if winexists("iguidence", "guidence") AND winexists "iguidence", "ready") Then However, now this discussion is more for future refference than present need. You see I found that the "ready" isent there durring navigation so...yeah. Howver it is still somethign good to know for other things. Thanx again to all; Lew Link to comment Share on other sites More sharing options...
jefhal Posted October 4, 2005 Share Posted October 4, 2005 (edited) It isn't possible to find a window containing two separate texts using a single call.Hi LxP-I "think" that this works because the "Visible Window Text" is "GuidanceLFReady" in Notepad. Is it possible that the "Visible Window Text" in LewCamino's app also contains something like "GuidanceLFReady"? If it does, then differentiation is possible. Nicht war? Edited October 4, 2005 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
LxP Posted October 5, 2005 Share Posted October 5, 2005 That's indeed possible, but I consider it safe to assume that this isn't the case. It was proven that AutoIt can detect such an occurrence. I guess the only way to be sure however would be to use ControlGetText() and inspect its output. 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