Jump to content
Sign in to follow this  
MarkRobbins

Hack a global hotkey and send to application

Recommended Posts

MarkRobbins

Here I am patrolling my tray apps and other apps on my system so as to keep an accurate map of global hotkeys and conflicts, but alas one slipped through and it took me a while to find out who the culprit is because in this case the hotkey is a no-op when there is nothing to do.

The offender is Growl for Windows, which hooks a global hotkey of Alt+Shift+X, (and Alt+X also i believe) but its interface does not allow disabling or remapping this hotkey.

I am pretty sure I can supersede this hotkey using Autohotkey (am not sure if it is a faux pax to mention AHK here), but it is able to hook any key even if the key is hooked via the global win api.

So my question is, if I can hook the key, can I resend it under-the-table so to speak to the focused app? By under-the-table I mean in a way so that it will not create a perpetual loop - been there, dunnit.

Or, does the win api expose a bouncer function that will allow an arbitrary app to clear a global hotkey created by another application? I am not sure how Growl is hooking things but that might be worth a try too.

Func FilePart($f,$n)

local $drive, $dir, $fn, $ext

_PathSplit($f, $drive, $dir, $fn, $ext)

if $n=='dl' Then Return StringLeft($drive,1)

if $n=='d' Then Return $drive

if $n=='drive' Then Return $drive

if $n=='dir' Then Return $dir

if $n=='n' Then Return $fn

if $n=='name' Then Return $fn

if $n=='e' Then Return StringRight($ext,StringLen($ext)-1)

if $n=='ext' Then Return $ext

if $n=='p' Then Return $drive&$path

if $n=='path' Then Return $drive&$path

if $n=='dp' Then Return $drive&$path&""

if $n=='p_' Then Return $drive&$path&""

if $n=='path_' Then Return $drive&$path&""

if $n=='ne' Then Return $fn&$ext

if $n=='nameext' Then Return $fn&$ext

if $n=='pn' Then Return $path&""&$fn

if $n=='dpn' Then Return $drive&$path&""&$fn

return SetError(-1,0,"")

EndFunc

Edited by MarkRobbins

Share this post


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
Sign in to follow this  

×