diikee Posted July 30, 2008 Share Posted July 30, 2008 #include <Process.au3> #include <File.au3> #include <IE.au3> Opt("WinTitleMatchMode",3) test() func test() $title = WinGetTitle("[active]") ConsoleWrite($title & @CRLF) $x = "755 settings" $y = "712D settings" $z = "852 settings" $w = "855 settings" if string($title) = $x Or $w then consolewrite("got here" & CRLF) elseif string($title) = $y Or $z then consolewrite("got there" & CRLF) else consolewrite("Try again" & CRLF) end funcconsole output:712 settingsgot herewhy did it print got here and not there??wintitlematchmode is set to 3 which should be exact match... Link to comment Share on other sites More sharing options...
Tomb Posted July 30, 2008 Share Posted July 30, 2008 #include <Process.au3> #include <File.au3> #include <IE.au3> Opt("WinTitleMatchMode",3) test() func test() $title = WinGetTitle("[active]") ConsoleWrite($title & @CRLF) $x = "755 settings" $y = "712D settings" $z = "852 settings" $w = "855 settings" if string($title) = $x Or $w then consolewrite("got here" & CRLF) elseif string($title) = $y Or $z then consolewrite("got there" & CRLF) else consolewrite("Try again" & CRLF) EndIf; <- this is what you were missing. end func Link to comment Share on other sites More sharing options...
herewasplato Posted July 30, 2008 Share Posted July 30, 2008 CRLF should be @CRLF end func should be EndFunc @OP, copy/paste semi working code to the forum :-) [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
diikee Posted July 30, 2008 Author Share Posted July 30, 2008 (edited) No, it's not, run the modified script and didn't work.I need a way to match the entire title string and not partial.- right now it's printing in comparison to the first 7xx instead of 712#include <Process.au3> #include <File.au3> #include <IE.au3> Opt("WinTitleMatchMode",3) test() func test() $title = WinGetTitle("[active]") ConsoleWrite($title & @CRLF) $x = "755 settings" $y = "712D settings" $z = "852 settings" $w = "855 settings" if string($title) = $x Or $w then consolewrite("got here" & @CRLF) elseif string($title) = $y Or $z then consolewrite("got there" & @CRLF) else consolewrite("Try again" & CRLF) EndIf; <- this is what you were missing. endfunc Edited July 30, 2008 by diikee Link to comment Share on other sites More sharing options...
enaiman Posted July 30, 2008 Share Posted July 30, 2008 (edited) This is your error: elseif string($title) = $y Or $z then I guess it should be elseif string($title) = $y Or string($title) = $z then In the first form that statement was always true since $z has a value. EDIT: the same thing with: if string($title) = $x Or $w then if string($title) = $x Or string($title) = $w then Edited July 30, 2008 by enaiman SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
herewasplato Posted July 30, 2008 Share Posted July 30, 2008 WinGetTitle returns a string, so no need to convert the var $title to a string and you might want double equal signs for case sensitive matching - or maybe not :-)Opt("WinTitleMatchMode", 3) test() Func test() $title = WinGetTitle("[active]") ConsoleWrite($title & @CRLF) $x = "755 settings" $y = "712D settings" $z = "852 settings" $w = "855 settings" If $title == $x Or $title == $w Then ConsoleWrite("got here" & @CRLF) ElseIf $title == $y Or $title == $z Then ConsoleWrite("got there" & @CRLF) Else ConsoleWrite("Try again" & @CRLF) EndIf EndFunc ;==>test [size="1"][font="Arial"].[u].[/u][/font][/size] 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