dew Posted January 21, 2009 Share Posted January 21, 2009 I am using Select (Case) based on the window dialog title (below). This is for testing various Windows applications (below is just a brief description). What I would like to know is, can "Case" be an "or" as well. I would like to use this in other Windows systems under different languages. So as an example: Using Accessibility Wizard the title in other language would be something like: Case $shWndFocus= "Accessibility Wizard" or "language2" or "language3" or ... (language2 lets say is French for "Accessibility Wizard") If this is not possible, is there any other way of doing this and not make the script into a monster? Select Case $shWndFocus = "Accessibility Wizard" ;Accessibility Wizard MouseClick("left", 365, 360) ;click next Sleep(2000) MouseClick("left", 455, 360) ;click cancel Case $shWndFocus = "calculator" ;Calculator Sleep(3000) WinClose($shWndFocus) ;close application Case $shWndFocus = "untitled - Paint" ;MS Paint Sleep(3000) WinClose($shWndFocus) ;close application EndSelect Link to comment Share on other sites More sharing options...
this Posted January 21, 2009 Share Posted January 21, 2009 (edited) Help file says Select statements may be nested. The expression can contain the boolean operators of AND, OR, and NOT as well as the logical operators <, <=, >, >=, =, ==, and <> grouped with parentheses as needed. However you might want to do something like this instead: Global $aAW = StringSplit("Accessibility Wizard|language2|language3") Select Case _ArraySearch($aAW,$shWndFocus)<>-1 [ other code here... ] Edited January 21, 2009 by this UDFsWinSineInOutResize () - Resize a window smoothly based on a sine curve. Link to comment Share on other sites More sharing options...
Valuater Posted January 21, 2009 Share Posted January 21, 2009 Maybe... Switch $shWndFocus Case "Accessibility Wizard", "Accessibility Wizard2" ; example MouseClick("left", 365, 360) ;click next Sleep(2000) MouseClick("left", 455, 360) ;click cancel Case "calculator" ;Calculator Sleep(3000) WinClose($shWndFocus) ;close application Case "untitled - Paint" ;MS Paint Sleep(3000) WinClose($shWndFocus) ;close application EndSwitch ; my previous use in autoit error reporting Case "_GUIToolTip_EnumTools", "_GUIToolTip_GetCurrentTool", "_GUIToolTip_GetToolInfo", "_GUIToolTip_HitTest", "_GUIToolTip_ToolToArray" http: / / www.autoitscript.com / forum / index.php?autocom = downloads & showfile = 104 8) Link to comment Share on other sites More sharing options...
enaiman Posted January 21, 2009 Share Posted January 21, 2009 Of course you can use logical operators there. Using your example, it is correct to write: Case $shWndFocus = "calculator" Or $shWndFocus = "untitled - Paint" Sleep(3000) WinClose($shWndFocus);close application 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...
fctd Posted January 21, 2009 Share Posted January 21, 2009 Take the one you like. expandcollapse popup;include library #Include <Array.au3> ;global definition Global $aAW = StringSplit("a|b|c","|") ; input $sOneLetter = InputBox("input", "Type letter a , b or c") ;output 1 Select Case $sOneLetter = "a" or $sOneLetter = "b" or $sOneLetter = "c" MsgBox(64,"output 1", "The letter was " & $sOneLetter) Case Else MsgBox(64, "output 1", "The letter was NOT a , b or c") EndSelect ;output 2 Select Case _ArraySearch($aAW,$sOneLetter) <> -1 MsgBox(64,"output 2", "The letter was " & $sOneLetter) Case Else MsgBox(64, "output 2", "The letter was NOT a , b or c") EndSelect ;output 3 Switch $sOneLetter Case "a", "b", "c" MsgBox(64,"output 3", "The letter was " & $sOneLetter) Case Else MsgBox(64, "output 3", "The letter was NOT a , b or c") EndSwitch ;output 4 Switch $sOneLetter Case "a" To "c" MsgBox(64,"output 4", "The letter was " & $sOneLetter) Case Else MsgBox(64, "output 4", "The letter was NOT a , b or c") EndSwitch [list][font="Century Gothic"]If nothing is certain, everything is possible.[/font][/list][font="Century Gothic"]Experience is something you get, just after you need it.[/font] Link to comment Share on other sites More sharing options...
Valuater Posted January 21, 2009 Share Posted January 21, 2009 You guys are kidding right?? 8) Link to comment Share on other sites More sharing options...
enaiman Posted January 21, 2009 Share Posted January 21, 2009 You guys are kidding right?? 8)which one? Because I'm not kidding. 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...
dew Posted January 22, 2009 Author Share Posted January 22, 2009 Of course you can use logical operators there. Using your example, it is correct to write: Case $shWndFocus = "calculator" Or $shWndFocus = "untitled - Paint" Sleep(3000) WinClose($shWndFocus);close applicationThanks, I like your answer for it is just what I needed. And No you are not kidding 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