AutoHotkey Community

It is currently May 27th, 2012, 2:53 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: November 28th, 2009, 7:49 am 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
This DOES work:
Code:
; ##############################################################################
#NoEnv
SetTitleMatchmode, 2
; ...
; ...
; ...
HotKey, IfWinActive, ^must be exactly another title$     ; MatchMode 3
Hotkey, a, Hotkey
Hotkey, IfWinActive
; ...
; ...
; ...
Gui, Margin, 0, 0
Gui, Font, s16
Gui, Add, Text, w400 h400 Center 0x200 cNavy vTX
Gui, Show, w400 h400, must be exactly another title
IfWinExist, exactly
   MsgBox, Found Gui window!`nMatchMode : %A_TitleMatchMode%
GuiControl, , TX, Press "a", please.
; ...
; ...
; ...
SetTitleMatchMode, RegEx
Return  ; end of auto-execute section
; ##############################################################################
GuiClose:
ExitApp
Hotkey:
   MsgBox, Title matched "must be exactly another title"`nMatchMode : %A_TitleMatchMode%
   Gui, Show, , title must start with ...
Return
#IfWinActive ^title must start with       ; MatchMode 1
a::
   MsgBox, Title matched "title must start with"`nMatchMode : %A_TitleMatchMode%
   Gui, Show, , ... title must contain ...
Return
#IfWinActive title must contain           ; MatchMode 2
a::
   MsgBox, Title matched "title must contain"`nMatchMode : %A_TitleMatchMode%
   Gui, Show, , title must be exactly
Return
#IfWinActive ^title must be exactly$      ; MatchMode 3
a::
   MsgBox, Title matched "title must be exactly"`nMatchMode : %A_TitleMatchMode%
   Gui, Show, , must be exactly another title
Return
#IfWinActive

Thanks to your code, i am gradually "getting" how SetTitleMatchMode works
- It is not positional (like #IfWinActive)
- It becomes the default for all code after it in time not position (ie not positional)

What i would like though is:
1) #SetTitleMatchMode (positional; for context-sensitive static (׃׃) hotkeys (ie using #IfWin))
2) SetTitleMatchModeP (positional; for context-sensitive dynamic (Hotkey) hotkeys (ie using Hotkey, IfWin))
* Keeping the current "SetTitleMatchMode" command as it is (as is also useful to have)
(That is, to have BOTH the standard AND positional versions of this command)

Ps: Yes i know nick, that everything in my code can be done with RegEx .. but i "don't want" to have to use RegEx for it all - i just want specifically to use RegEx for (this part of my code) but not for (that part of my code). Call it "programmer discretion" :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 28th, 2009, 9:51 am 
Offline

Joined: August 24th, 2005, 5:29 pm
Posts: 549
Location: Berlin / Germany
Good morning a_h_k,

I'd say, SetTitleMatchMode is positional for all commands other than #IfWin or Hotkey, IfWin and the last one in the auto-execute section is positional for those and all following commands, because it becomes the default matching mode.

Using RegEx it's quite simply to determine the matching behavior for #IfWin and Hotkey, IfWin. On the other hand, if some really need an individual matching for context-sensitive hotkeys without using RegEx, I'd prefer an additional option MatchMode to overwrite the default, though I don't know how hard implementing would be.

_________________
nick :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 28th, 2009, 4:52 pm 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
nick wrote:
I'd say, SetTitleMatchMode is positional for all commands other than #IfWin or Hotkey, IfWin and the last one in the auto-execute section is positional for those and all following commands, because it becomes the default matching mode
Correct. And what i want is is for (a version of) SetTitleMatchMode to be positional for #IfWin or Hotkey, IfWin also

nick wrote:
... additional option MatchMode to overwrite the default
Good idea!!!


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group