Jump to content

Setting Hotkeys for Windows with Different Titles

Recommended Posts

Hey all; thanks in advance for any help.

I'm working on a hotkey macro for a program I use for work; I haven't started coding yet, just sort of rough outlining pseudocode while I research different AutoIt functions.

I know I want to use ControlClick for selecting the applications functions, but it looks like ControlClick requires the window title. The problem is the application i'm using changes the window title based on the file that I'm editing. It looks like I can use WinGetTitle and save the current title as a string, which I can input into the ControlClick command. Correct me if I'm wrong, but as I understand it I start the script, then it's running that while loop in the background, waiting for any of the hotkey functions that I've set; Since WinGetTitle only acts on the active window, will I need to insert it into every single function that I have hotkeys mapped to? I can't declare/run it at the beginning of the program, since when I start the script my active window is not the application I'm working in - does that sound correct?

Also a secondary question if anyone has the time, I'm looking for a way such that the script is constantly running, but is only active when the specific window/application is open. Is there a way to activate only when you activate a window, and have it idle the background while you're working in other windows?

Thanks again.

Link to post
Share on other sites

You can try with a Global Keyboard hook. when the specified hotkey is pressed check it and if the required window is activated call the respective function.

orelse for more ease you can modify the HotString UDF.

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...