| View previous topic :: View next topic |
| Author |
Message |
whynot
Joined: 06 Aug 2004 Posts: 10
|
Posted: Thu Aug 19, 2004 7:56 pm Post subject: Multiple IF criteria? |
|
|
If there's a way to do this already, I apologize for putting this in the Wish List forum, but I haven't came across this yet in my searches.
How about a way to seperate multiple criteria via a pipe symbol (|), or something similar?
My particular situation is that I'm trying to restrict certain actions based on the active window, and while appears do-able via multiple IF/THEN branches, it'd be nice if you could do this with simple pipes. Something like this:
SetTitleMatchMode, 2
IfWinNotActive, Microsoft | - Message | Outlook
{
Send, <br /><br />
}
versus...
SetTitleMatchMode, 2
IfWinNotActive, Microsoft
{
IfWinNotActive -Message
{
IfWinNotActive Outlook
{
Send, <br /><br />
}
}
}
Hope that's clear... Tabs do not seem to be part of the BBCode languages, so formatting is... non-existant really.  |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10465
|
Posted: Thu Aug 19, 2004 8:46 pm Post subject: |
|
|
With the new commands just added, you could do this instead:
| Code: | WinGetTitle, active_title, A
if active_title not in Microsoft,- Message,Outlook ; Note no spaces between commas.
{
Send ...
} |
The only problem is that active_window must exactly match one of the items in MatchList. Someone suggested allowing a substring-match option, which I think I'll add. |
|
| Back to top |
|
 |
whynot
Joined: 06 Aug 2004 Posts: 10
|
Posted: Thu Aug 19, 2004 11:00 pm Post subject: |
|
|
| Chris wrote: | With the new commands just added, you could do this instead:
...
The only problem is that active_window must exactly match one of the items in MatchList. Someone suggested allowing a substring-match option, which I think I'll add. |
A substring version of that would meet my needs perfectly! Thanks for the info. Chris, and I'll keep an eye out for such an update.
Take care. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10465
|
Posted: Thu Aug 26, 2004 4:06 am Post subject: |
|
|
This has been added to the installer at http://www.autohotkey.com/download/ -- thanks for the idea
Added command "if var [not] contains MatchList", which is the same as using IfInString/IfNotInString except that multiple search strings are supported (any one of which will cause a match). [thanks whynot] |
|
| Back to top |
|
 |
Candle
Joined: 19 Aug 2004 Posts: 334
|
Posted: Thu Aug 26, 2004 4:12 am Post subject: |
|
|
The YES or NO will come in handy .
InputBox, UserInput, Enter YES or NO
if UserInput not in yes,no
MsgBox Your input is not valid. |
|
| Back to top |
|
 |
|