AutoHotkey Community

It is currently May 27th, 2012, 11:40 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Wild card for ahk_class?
PostPosted: August 5th, 2004, 5:16 am 
Offline

Joined: May 24th, 2004, 7:45 pm
Posts: 23
Location: Bellevue, WA USA
I use RSS Bandit (www.rssbandit.org) as my RSS reader. I have a script in AHK that, whenever I click both the left and right mouse buttons, it sends a command to close the window in whatever Web browser I'm using. I want to do the same thing for the tabbed windows in RSS Bandit.

Only problem, I like to use ahk_class rather than the window title to make sure which app is frontmost, and the ahk_class of RSS Bandit changes every time I launch the program.

Sometimes it's WindowsForms10.Window.8.app3 but right now it's ahk_class WindowsForms10.Window.8.app4.

Those are the only two values I've seen (it changes each restart) so maybe I only have to check those two options, but I'm wondering whether it makes sense to have a wildcard option in the ahk_class.

Or maybe this is a very special case.

_________________
Tommy


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 5th, 2004, 8:57 am 
Quote:
... so maybe I only have to check those two options ...
Just for the crowd - cause you still seems to know it: WinGetClass, OutputVar [, WinTitle, WinText, ExcludeTitle, ExcludeText]

Yep, no idea if SetTitleMatchMode covers that topic. If not, would it make sense to include this function as an additional parameter or to create SetClassMatchMode ?

btw. how to loop the app extension ?

Loop, 9
{
ac ++
IfWinExist, WindowsForms10.Window.8.app%ac%
{
WinClose
}
}


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 5th, 2004, 12:38 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Quote:
SetClassMatchMode

It would probably would be too rarely used to justify adding it. The solutions you proposed are the way to do it in this case. Specifically:
Code:
WinGetClass, active_class, A
IfInString, active_class, WindowsForms10.Window
     WinClose, A


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 5th, 2004, 4:40 pm 
:D


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 5th, 2004, 6:23 pm 
Offline

Joined: May 24th, 2004, 7:45 pm
Posts: 23
Location: Bellevue, WA USA
Chris wrote:
The solutions you proposed are the way to do it in this case. Specifically:
Code:
WinGetClass, active_class, A
IfInString, active_class, WindowsForms10.Window
     WinClose, A


I wasn't aware of the WinGetClass method -- I suppose I should have been aware of it, but I wasn't. This works better than what I was thinking of. Thanks.

_________________
Tommy


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 10th, 2008, 1:14 pm 
I was curious on this... I am pretty new to AHK and am running into a window title issue as well. I like using the class but it also has variations based on the instance opened.

is there a wildcard option at all?

how would you apply the wingetclass function?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 10th, 2008, 1:44 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Look into http://www.autohotkey.com/docs/commands ... chMode.htm, which also has regex option (e.g. wildcards)

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 10th, 2008, 2:02 pm 
Thanks I will check it out... g


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 11th, 2008, 6:33 am 
Hello again! I got my process to function with the Regex process but wanted to add in a bit of error handling and am not sure what this should look like.

pretty much I want to do is use a key command to activate the script but be sure that if I havent opened the window to select a page range first that it doesnt go through all the menus to change trays print locations etc.

how do I tell it to interupt and go back to the begining and wait for the window to actually be present in the background or active in the event I prematurely sent the key command to run it?

man I hope that make sense... sounds confusing to me. :shock:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 31st, 2009, 8:31 pm 
Offline

Joined: September 28th, 2004, 7:10 am
Posts: 17
I ran into a similar situation with processing MDI Child windows, which act more like controls than like child windows. In an application I automate all the time, I need to be able to find child windows under a given parent whos classname matches a particular class pattern. I do it with something like this:

Code:
; Find a Clarion MDI Child window whos title matches a specified pattern.  Note that this is
; sample code, and omits all error processing, etc.

MainWindowTitle := "Specify the Main Window here as a Regex"
TargetChild     := "Specify the child window name as a Regex"

SetTitleMatchMode, Regex
ControlGet MdiHandle, hWnd, , MDIClient1, ^
WinGet MsqControls, ControlListHwnd , ahk_id %MdiHandle%
Loop, Parse, MsqControls, `n
{
   WinGetClass ChildClass, ahk_id %A_LoopField%
   if(!RegexMatch(ChildClass, "^ClaWin"))
      Continue

   WinGetTitle Title, ahk_id %A_LoopField%
   if(RegexMatch(Title, TargetChild))
   {
      Result := A_LoopField
      break
   }
}



Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

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