Author |
Topic |
|
Cerberus
Netherlands
86 Posts |
Posted - 05/05/2012 : 09:41:38
|
What happens if a window/control matches several "applications"? I am thinking of one general application for e.g. Firefox, and one that matches only Firefox windows with certain titles. |
|
Rob
USA
2615 Posts |
Posted - 05/05/2012 : 19:03:21
|
It will stop processing once it reaches an application match, then try to match the drawn gesture to an action (though if no match exists for that application, the only additional check would look for the gesture/action match in Global (wouldn't proceed to the next application match). The order of processing is based on the order of creation in StrokesPlus.xml (it processes top-down). In theory, I was never able to think of a reason why there would be a use case for multiple matches. A gener match can further determine the course of action within the Lua. For example, I have a Login action for Chrome, in that action, it gets the title of the window, then executes different things based on the title..just as an example alternative.
There are various potential approaches to what you're trying to do; give me an example or two of what you'd like to have happen. |
|
|
Cerberus
Netherlands
86 Posts |
Posted - 05/05/2012 : 19:12:47
|
Ah OK, thanks for clearing that up. I might want to perform different actions based on the page I was on in Forefox, but, as you say, that can easily be done with Lua or AHK, so multiple match checking is unnecessary (and probably slower). I mainly asked out of general curiosity; I already differentiate actions based on FF page titles with AHK anyway. |
|
|
Rob
USA
2615 Posts |
Posted - 05/05/2012 : 19:16:18
|
But remember you can also make an application definition using a regular expression pattern as well. Kind of a pain for a bunch of title checks, but perfectly possible. |
|
|
Cerberus
Netherlands
86 Posts |
Posted - 05/05/2012 : 20:01:50
|
Yeah I have noticed. It is pretty cool, so you could make one application "all Firefox windows except Google", and one "all Firefox windows with Google". How much would you reckon this slows things down? |
Edited by - Cerberus on 05/05/2012 20:06:54 |
|
|
Rob
USA
2615 Posts |
Posted - 05/05/2012 : 20:13:19
|
Not much, the regex is very efficient (it uses the BOOST libraries). |
|
|
Hax
128 Posts |
Posted - 06/07/2012 : 05:43:19
|
I have three window classes: Winamp v1.x Winamp PE Winamp Gen
I'd like to know how to make a single regular expression pattern for them. |
|
|
Rob
USA
2615 Posts |
Posted - 06/07/2012 : 08:04:38
|
The regex to use would be:
Winamp (v1\.x|PE|Gen) However, your question uncovered a HUGE bug with the App pattern matching..basically, the expression entered was being stored in a const variable, so the first time a valid expression was matched, it became a permanent fixed value until S+ was restarted. I was still really new to C++ at the time and I'm sure I copy/pasted some code I found. I don't use the patterns so a simple test of the code would work fine because I wasn't trying others!
Update to version 1.9.4.
I can see you trying regex patterns that SHOULD work, but nothing was going your way at all, am I right? =)
I actually made 3 windows apps which use the class names you mentioned and tested the match on all, so you shouldn't have a problem with actual Winamp. |
|
|
Hax
128 Posts |
Posted - 06/07/2012 : 08:30:33
|
Yeah, I tried several patterns without success. The new version has fixed that thing. It's OK now. Thanks! |
|
|
|
Topic |
|