从图标托盘更改图片


0

我已经搜索了很多关于这个的帖子,但是我无法理解它们......

是否可以将H图标更改为其他内容以及S(暂停),如果它被暂停,将切换到另一个图像。

Answers:


0

当脚本的热键暂停时,其托盘图标将更改为字母S.这可以通过冻结图标来避免,这可以通过为Menu命令的最后一个参数指定1来完成。例如:

菜单,托盘,图标,C:\ My Icon.ico ,, 1

https://autohotkey.com/docs/commands/Suspend.htm#Remarks

要在暂停脚本时更改托盘图标,您需要定义一个热键,例如

!s::
Menu,Tray,Icon, C:\My Icon2.ico, , 1
Suspend On
return

#If (A_IsSuspended)

    !s::
    Suspend Off
    Menu,Tray,Icon, C:\My Icon.ico, , 1
    return

#If

或计时器:

#Persistent
SetTimer, change_tray_icon, 100
return

    change_tray_icon:
If (A_IsSuspended)
    Menu,Tray,Icon, C:\My Icon2.ico, , 1
else
    Menu,Tray,Icon, C:\My Icon.ico, , 1
return

0

您需要使用Menu命令。暂停程序时,通过使用不同的图标再次调用相同的命令来更改图标。当取消暂停时再次调用命令以显示常规图标。

; active
Menu, Tray, Icon, yourregularicon.ico ; to replace H
; suspend
Menu, Tray, Icon, yoursuspendicon.ico ; to replace H

文档:https//autohotkey.com/docs/commands/Menu.htm

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.