I use a lot of little vb.net programs (made with VBExpress 2010) and a lot of little AutoHotkey scripts, and I really want them to be able to communicate easily.

My prime example is a Me.Hide form with a NotifyIcon that has a ContextMenu. The menu activates when I right-click the icon. I want a way for my AHK script to tell the .net app to open this ContextMenu.

^a::SendInput {AppsKey}  ; Ctrl+A to activate the right-click menu

If you need to select a certain item on the menu you can send arrow keys and enter usually, or the shortcut key for the item

^a::                     ; Ctrl+A
    SendInput {AppsKey}  ; Activate the right-click menu
    SendInput {Down 2}   ; Go down to the second item
    SendInput {Enter}
  • Okay, to clarify, the Notifyicon is visible in the tray, but I want it to be a global hotkey, so how to I bring the NotifyIcon into focus? (Also sorry, I wrote this post on three hours of sleep, so a lot of details got left out) – Caleb Apr 1 '16 at 4:31
  • I can only comment on the AutoHotkey side of things, in which case you can either have AutoHotkey click on the icon itself by finding the icon in the tray and clicking there, or you can have it send a shortcut key (but in that case you need to have the vb.net able to detect the shortcut key and respond to it, which I don't know how to do). A third option might be to click the icon programmatically (i.e., send a click to the running program instead of trying to mouseClick X, Y), but that would probably be even more difficult to figure out. – JJohnston2 Apr 2 '16 at 1:00

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.