So I have tried to come up with a script that performs actions on the basis of two criterion. The first criteria is the application whose window is currently active, and after that it looks for what profile is currently active (profile is a variable that I can control with pre defined hotkeys for each profile).
So the idea was to be able to do multiple tasks using the same hotkeys which means as the profile changes, the task performed by the same hotkey changes as well. And all these definitions of hotkeys needs to be different depending on which windows is currently active. I can imagine at most seven profiles for a given application, but let's just say, the entire number row will be used for activating a different profile, so that's ten profiles max.
I imagine this to be similar to a menu bar of an application. Just like we know the items of a menu bar usually go like this File Edit View Help, similarly I hope to get used to these profiles so much that I'll remember which does what after repeated use.
I just have this issue of the tooltip not functioning properly, which is very critical for this script and is also I believe, the final kink that's holding me from incorporating this script into my daily usage.
For some reason the tooltip never appears. I expect it to appear near the cursor for the defined period of time when I press the hotkeys to switch to any given profile.
Anyway here is what I've been working with, and thanks in advance.
Code: Select all
XButton1 & 2:: ; Hotkey to activate profile
ProfileName := "Second"
ToolTip, % ProfileName[Profile]
SetTimer, ToolTipOff, -1000
return
XButton1 & 3:: ; Hotkey to activate profile
ProfileName := "Third"
ToolTip, % ProfileName[Profile]
SetTimer, ToolTipOff, -1000
return
XButton1 & 4:: ; Hotkey to activate profile
ProfileName := "Fourth"
ToolTip, % ProfileName[Profile]
SetTimer, ToolTipOff, -1000
return
XButton1 & 5:: ; Hotkey to activate profile
ProfileName := "Fifth"
ToolTip, % ProfileName[Profile]
SetTimer, ToolTipOff, -1000
return
XButton1 & 6:: ; Hotkey to activate profile
ProfileName := "Sixth"
ToolTip, % ProfileName[Profile]
SetTimer, ToolTipOff, -1000
return
XButton1 & 7:: ; Hotkey to activate profile
ProfileName := "Seventh"
ToolTip, % ProfileName[Profile]
SetTimer, ToolTipOff, -1000
return
ToolTipOff:
ToolTip
return
; Google Chrome
#If WinActive("ahk_exe chrome.exe")
Tab::Tab
Tab & 1::Send !{Left} ;Alt ← Page ←
Tab & 2::Send !{Right} ;Alt → Page →
Tab & 3::Send ^+{Tab} ;Ctrl Shift Tab Tab ←
Tab & 4::Send ^{Tab} ;Ctrl Tab Tab →
XButton2::Send +{F3} ; Find Previous
XButton1::Send {F3} ; Find Next
;WheelUp::Send {Right} ;
;WheelDown::Send {Left} ;
;MButton::
return
#If WinActive("ahk_exe chrome.exe") && ProfileName = "Second" ;
CapsLock::CapsLock
CapsLock & w::Send ^+{Left} ;Select Text One Word ←
CapsLock & e::Send ^+{Right} ;Select Text One Word →
CapsLock & q::Send +{Left} ;Select Text One Char ←
CapsLock & r::Send +{Right} ;Select Text One Char →
CapsLock & s::Send ^{Left} ;Move Cursor One Word ←
CapsLock & d::Send ^{Right} ;Move Cursor One Word →
CapsLock & a::Send ^{Backspace} ;Remove One Word ←
CapsLock & f::Send ^{Delete} ;Remove One Word →
#If WinActive("ahk_exe chrome.exe") && ProfileName = "Third" ; Reading Text
XButton1 & WheelDown::Send ^+{Left} ;Select Text One Word ←
XButton1 & WheelUp::Send ^+{Right} ;Select Text One Word →
XButton1 & LButton::Send {Backspace}
XButton1 & RButton::Send {Delete}
;CapsLock & q::Send +{Left} ;Select Text One Char ←
;CapsLock & r::Send +{Right} ;Select Text One Char →
#If WinActive("ahk_exe chrome.exe") && ProfileName = "Fourth" ;
XButton1 & WheelDown::Send ^{Left} ;Move Cursor One Word ←
XButton1 & WheelUp::Send ^{Right} ;Move Cursor One Word →
#If WinActive("ahk_exe chrome.exe") && ProfileName = "Fifth" ;
XButton1 & WheelDown::Send ^{Backspace} ;Remove One Word ←
XButton1 & WheelUp::Send ^{Delete} ;Remove One Word →
#If WinActive("ahk_exe chrome.exe") && ProfileName = "Sixth" ; YouTube
XButton1 & WheelUp::Send {Right}
XButton1 & WheelDown::Send {Left}
XButton1 & LButton::Send +{<} ; Decrease Speed
XButton1 & RButton::Send +{>} ; Increase Speed
#If WinActive("ahk_exe chrome.exe") && ProfileName = "Seventh" ; Zoom
XButton1 & WheelUp::Send ^{+} ; Zoom Out
XButton1 & WheelDown::Send ^- ; Zoom In
;Windows Explorer
#If WinActive("ahk_class CabinetWClass")
#If WinActive("ahk_class CabinetWClass") && ProfileName = "Second" ;
XButton1 & WheelDown::Send +{Down} ;Selection Contiguous Text/Item ↓
XButton1 & WheelUp::Send +{Up} ;Selection Contiguous Text/Item ↑
#If WinActive("ahk_class CabinetWClass") && ProfileName = "Third" ;
XButton1 & WheelDown::Send +{Left} ;Selection Contiguous Text/Item ←
XButton1 & WheelUp::Send +{Right} ;Selection Contiguous Text/Item →
#If WinActive("ahk_class CabinetWClass") && ProfileName = "Fourth" ;
XButton1 & WheelDown::Send ^{Down} ;Selection Non-Contiguous Item ↓
XButton1 & WheelUp::Send ^{Up} ;Selection Non-Contiguous Item ↑
#If WinActive("ahk_class CabinetWClass") && ProfileName = "Fifth" ;
XButton1 & WheelDown::Send ^{Left} ;Selection Non-Contiguous Item ←
XButton1 & WheelUp::Send ^{Right} ;Selection Non-Contiguous Item →
XButton1 & LButton::Send ^{Space} ;Select/Deselect Item