AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Multiple IF criteria?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
whynot



Joined: 06 Aug 2004
Posts: 10

PostPosted: Thu Aug 19, 2004 7:56 pm    Post subject: Multiple IF criteria? Reply with quote

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. Very Happy
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10465

PostPosted: Thu Aug 19, 2004 8:46 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
whynot



Joined: 06 Aug 2004
Posts: 10

PostPosted: Thu Aug 19, 2004 11:00 pm    Post subject: Reply with quote

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
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10465

PostPosted: Thu Aug 26, 2004 4:06 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Candle



Joined: 19 Aug 2004
Posts: 334

PostPosted: Thu Aug 26, 2004 4:12 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group