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 

IfWinActive usage - shame on me...

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
hs2



Joined: 25 Feb 2005
Posts: 11
Location: Germany

PostPosted: Sat Mar 19, 2005 2:43 pm    Post subject: IfWinActive usage - shame on me... Reply with quote

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



Joined: 08 Nov 2004
Posts: 1221

PostPosted: Sat Mar 19, 2005 3:54 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
hs2



Joined: 25 Feb 2005
Posts: 11
Location: Germany

PostPosted: Sat Mar 19, 2005 4:48 pm    Post subject: Reply with quote

Of course I've already checked that - looks good Sad
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
View user's profile Send private message
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Sat Mar 19, 2005 5:48 pm    Post subject: Reply with quote

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! Cool
Back to top
View user's profile Send private message
hs2



Joined: 25 Feb 2005
Posts: 11
Location: Germany

PostPosted: Sat Mar 19, 2005 6:03 pm    Post subject: Reply with quote

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 Sad
Is there a problem using 'ahk_class <class>, <WinText>' as win spec. ?
Back to top
View user's profile Send private message
hs2



Joined: 25 Feb 2005
Posts: 11
Location: Germany

PostPosted: Sat Mar 19, 2005 6:35 pm    Post subject: Reply with quote

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


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Sat Mar 19, 2005 7:27 pm    Post subject: Reply with quote

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



Joined: 25 Feb 2005
Posts: 11
Location: Germany

PostPosted: Sat Mar 19, 2005 8:21 pm    Post subject: Reply with quote

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 Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help 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