Another Dark UI

 From:  RobertH
7180.10 
Hi 2byts,

The code below will show you how to setup AutoHotKey to work with specific applications. Basically you need to test if a window/app is active, set whatever commands for that app you want, then setup for the next app (or all apps). This is done with the following code for Moi:


#IfWinActive ahk_class MoiMainWindow


Every command that follows will apply to Moi until the next #IfWinActive ahk_class command is encountered. You can have one script work with many application. For instance I want all my applications to save data using F12 and if the application itself doesn't allow for remapping of keys I stick it in my main AutoHotKey script.

To determine the "ahk_class" for an application, do the following. When an AutoHotKey script is running (I don't remember if this works with a compiled EXE script), right click on the AutoHotKey icon in the system tray and select "Window Spy". Then run whatever application you want and Window Spy will tell you the class of that app along with other info, to be use in the #IfWinActive ahk_class parameter.

Look at the following example for setting up keys in one script for Moi, WordPad, PhotoShop, Solitaire followed by all applications.

HTH

 

================================================
;
;
; Settings in beginning of file
;

#SingleInstance force
#InstallKeybdHook
#InstallMouseHook
SetTitleMatchMode, 2

;
; Special Auto Hot Key Keystrokes
;
; ^ = Ctrl (Hold down the Ctrl key)
; ! = Alt (Hold down the Alt key)
; + = Shift (Hold down the Shift Key)
; # = WIN (Hold down the WIN key)
;

 

;
; Remap Moi
;
#IfWinActive ahk_class MoiMainWindow

 

;
; Remap WordPad
;
#IfWinActive ahk_class WordPadClass
F12::^s

 

;
; Remap Photoshop
;
#IfWinActive ahk_class Photoshop
!e::^!+E ; Copy Merged - Visible Layers Snap Shot
z::!^z ; Step Backward (undo)


;
; Remap Solitaire
;
#IfWinActive ahk_class Windows.UI.Core.CoreWindow
XButton1::g


#IfWinActive ; This puts subsequent remappings and hotkeys in effect for all windows.

================================================