Menu, Tray, Icon, busted…

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
AJBlue98
Posts: 2
Joined: 21 Sep 2015, 07:57

Menu, Tray, Icon, busted…

29 Feb 2016, 03:30

I've been working on something it looks like several other people have tried to do: suspend a script when a particular window (in my case Visio) is active.

The script I'm using causes Windows to imitate the Mac's keyboard layout and common hotkey functions. Visio chokes on it. So I've done my homework and come up with the following …

Code: Select all

;
;   SUSPEND THIS FILE FOR MICROSOFT VISIO WINDOWS
;
#IfWinActive ahk_class VISIOA
  Menu, TRAY, Icon, C:\Program Files\AutoHotkey\AutoHotkey.exe, 5
  Suspend on
  #IfWinNotActive ahk_class VISIOA
    Suspend off
    Menu, TRAY, Icon, *
Return
… Which works, except for the Menu commands.

When the Menu lines are omitted, the script's icon doesn't change when the Suspend on command runs. I'd like to use the fifth (white-S-on-red) icon in the AHK executable when Visio is in the foreground, to indicate the script is suspended programmatically instead of manually. When the script is run as written above, the Suspend on and Suspend off command runs, but still nothing happens to the system tray icon.

I'd be grateful for any help anyone could provide re. making this work!

—Russ Johnson
Nashville, Tenn.
hitman
Posts: 21
Joined: 10 Aug 2014, 06:47

Re: Menu, Tray, Icon, busted…

17 Nov 2020, 09:49

Code: Select all

#Persistent
SetTimer, showNext, 500
return

showNext:
ifwinactive ahk_class VISIOA
  Suspend on
else
{
  Suspend off
  Menu, TRAY, Icon, *   ;恢复默认
  }
return
AJBlue98
Posts: 2
Joined: 21 Sep 2015, 07:57

Re: Menu, Tray, Icon, busted…

13 Mar 2023, 10:28

Please forgive the extremely late reply — somehow this got lost in the shuffle. I gave up on getting the icon to change … but since I’m at a new job again using Visio, I’m again trying to solve the same problem, and this solution works almost perfectly, thank you!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: arrondark and 95 guests