Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

IfWinActive and wild cards


  • Please log in to reply
8 replies to this topic
  • Guests
  • Last active:
  • Joined: --
Hi all,

I searched in the forum, but couldn't find an answer.

It looks like that ifwinactive doesn't support wildcards.

What would I have to do to get something equivalent to
#ifwinactive ahk_class *WindowClass (wild cards)
or
#ifwinactive ahk_class .*WindowClass (regexp)

I would be very happy about any pointer!

AnyPointer
  • Guests
  • Last active:
  • Joined: --
SetTitleMatchMode, RegEx

  • Guests
  • Last active:
  • Joined: --
Thanks for the pointer! I overlooked that!

I tried it now, but it doesn't work in my case. I guess this the same problem that Rexx has with his script!

<!-- m -->http://www.autohotke...ic14641-60.html<!-- m -->

  • Guests
  • Last active:
  • Joined: --

This command affects the behavior of all windowing commands, e.g. IfWinExist and WinActivate.

As long as you won't provide your code, you might wait forever to be supported :roll:

  • Guests
  • Last active:
  • Joined: --
Thanks and sorry :-) The code is actually

SetTitleMatchMode, RegEx

#IfWinActive ahk_class .*MozillaUIWindowClass
XButton1::Send ^{Click}

#IfWinActive ahk_class .*IEFrame
XButton1::Send ^{Click}
But it doesn't work with Sandboxie eindows.

The class could be prefixed with "Sandbox:DefaultBox:". For example The
Au3 Window Spy would show "Sandbox:DefaultBox:IEFrame" as class. The prefix can be variable.

No idea, why the code doesn't work. Any ideas?

  • Guests
  • Last active:
  • Joined: --
Sorry, I mean to say:

But it doesn't work with Sandboxie windows.

  • Guests
  • Last active:
  • Joined: --
I guess nobody has an idea why this doesn't work?

Probably Sandboxie is not that popular yet, but I recommend it highly. It's is freeware and a small download ... It is very useful to protect your system from malware (especially if you like to download small utilities, scripts, but are not sure whether the sources is trustworthy).

<!-- m -->http://sandboxie.com<!-- m -->

I guess the problem with sandboxie is that all "sandboxed" applications have a prefix in the class identifier. Unfortunately autohotkey is not able to deal with this (but au3 apparently can).

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
Why do you need wildcard?
#IfWinActive ahk_class MozillaUIWindowClass
XButton1::Send ^{Click}
#IfWinActive

#IfWinActive ahk_class IEFrame
XButton1::Send ^{Click}
#IfWinActive

If you need wildcard, please show ahk_class for window that does not work using RegEx.

sinkfaze
  • Moderators
  • 6367 posts
  • Last active: Nov 30 2018 08:50 PM
  • Joined: 18 Mar 2008
#IfWinActive ahk_class .*MozillaUIWindowClass

Try this:

#IfWinActive ahk_class (?:Sandbox:(?:\w+)Box:)?MozillaUIWindowClass

If that doesn't work you can always specify a group in the auto-execute portion of your script with the two different types of ahk classes and put both types into the group:

GroupAdd, FirefoxClass, ahk_class MozillaUIWindowClass
GroupAdd, FirefoxClass, ahk_class [color=brown]<< Sandboxie prefix >>[/color]MozillaUIWindowClass

Then just use ahk_group FirefoxClass (or whatever name you give to the group) for the WinTitle.