AutoHotKey - Getting script to run only in certain programs

Posted on 2011-03-22
Last Modified: 2012-05-11
I'm running the script below in AutoHotKey

If WinActive("ahk_class MozillaUIWindowClass") Or WinActive("ahk_class MozillaWindowClass")
  Send, {Ctrldown}k{CtrlUp}

It works great in Firefox to send a Control + k when I press Control + e.

The issue is when I use any other programs.  Control + e makes nothing happen. I want control + e to still work in other apps.

I tried putting in an else like this:
  Send, {Ctrldown}e{CtrlUp}

...but then the script then loops and my PC gets crazy.

Any and all help is appreciated!

Thank you,

Question by:JohnMan777
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

Unattended earned 500 total points
ID: 35879452
Send, ^k

or your window title definition might not be right:
If WinActive("ahk_class MozillaUIWindowClass") Or WinActive("ahk_class MozillaWindowClass")

I tried it with notepad, and it worked fine for me.
LVL 53

Expert Comment

ID: 36128377
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Author Comment

ID: 36105532
This got it working:

#IfWinActive ahk_class MozillaWindowClass





Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question