| View previous topic :: View next topic |
| Author |
Message |
hs2
Joined: 25 Feb 2005 Posts: 11 Location: Germany
|
Posted: Sat Mar 19, 2005 2:43 pm Post subject: IfWinActive usage - shame on me... |
|
|
This doesn't match the Thunderbird Compose window, but why ...
It's intended to specify the window as exact as possible.
| Code: | | IfWinActive, ahk_class MozillaWindowClass, Compose: |
What's my mistake/misunderstanding ? |
|
| Back to top |
|
 |
Serenity
Joined: 08 Nov 2004 Posts: 1221
|
Posted: Sat Mar 19, 2005 3:54 pm Post subject: |
|
|
My guess is the problem lies with "Compose:" - I might be wrong, try running WinSpy and see what comes up. I've found with some windows, even though the text is visible to me, it doesn't necessarily show up in WinSpy. It should be able to create a match based on text seen by WinSpy. _________________ "Anything worth doing is worth doing slowly." - Mae West
 |
|
| Back to top |
|
 |
hs2
Joined: 25 Feb 2005 Posts: 11 Location: Germany
|
Posted: Sat Mar 19, 2005 4:48 pm Post subject: |
|
|
Of course I've already checked that - looks good
I'm a bit doubtful concerning the use of ahk_class in conjunction with the WinText part...
Anyway - I use this as an workaround for the time being:
| Code: |
IfWinActive, ahk_class MozillaWindowClass
{
WinGetActiveTitle, Title
IfInString, Title, Compose:
{
...
|
|
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Sat Mar 19, 2005 5:48 pm Post subject: |
|
|
| Quote: | | Code: | WinGetActiveTitle, Title
IfInString, Title, Compose: |
|
You know, you'd get the exact same effect here by setting the title match mode to two using SetTitleMatchMode and IfWinActive. Look 'em up!  |
|
| Back to top |
|
 |
hs2
Joined: 25 Feb 2005 Posts: 11 Location: Germany
|
Posted: Sat Mar 19, 2005 6:03 pm Post subject: |
|
|
Right jonny - tried that already. Missed that in my 1st code snippet.
But as I wrote: no match ... double checked w/ Window Spy - everything looks fine - no idea
Is there a problem using 'ahk_class <class>, <WinText>' as win spec. ? |
|
| Back to top |
|
 |
hs2
Joined: 25 Feb 2005 Posts: 11 Location: Germany
|
Posted: Sat Mar 19, 2005 6:35 pm Post subject: |
|
|
I re-read the help again (and again):
| Quote: | | WinText: If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if DetectHiddenText is ON. |
hmm... I did a WinGetText on my window and it was empty.
I think WinText has obviously nothing to do w/ the title, but what is it ??? |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Sat Mar 19, 2005 7:27 pm Post subject: |
|
|
WinText is text that appears beneath a window's title bar. More specifically, it is the captions of all controls in the window. You can discover a windows exact WinText with Window Spy (or using WinGetText as you did).
It is possible to use ahk_class and WinText together, but not ahk_class+title (but this is a good suggestion if only there were some way to do it without breaking existing scripts). |
|
| Back to top |
|
 |
hs2
Joined: 25 Feb 2005 Posts: 11 Location: Germany
|
Posted: Sat Mar 19, 2005 8:21 pm Post subject: |
|
|
Thanks Chris, that's the explanation I was looking for.
Anyway, it's not a big deal 'cause doing
| Code: | IfWinActive, ahk_class <AHK_CLASS>
IfWinActive, <title-string>
{ ... |
is good code too.
And nobody wants to break existing code w/o a GOOD reason  |
|
| Back to top |
|
 |
|