트레이 아이콘을 깜박이지 않고 새로 고침을하려면.
리틀 트릭으로 그렇게 할 수 있습니다.
이것을 해결하기 위해 (외부 트레이 아이콘과 함께 트레이 메뉴)
이 두 개의 Ahk Script를 시도하면 곧 갈 준비가됩니다.
더 이상 당신의 모든 변수 또는 다른 것을 지우기 위해 많은 코드 라인을 작성하지 않아야합니다.
주 - 이것은 수행 할 수 있음을 보여주는 간단한 예일뿐입니다.
Example1.ahk
#Notrayicon
#SingleInstance force
;Click on <esc> key - to exit
;Click on <f1> key - to do an Reload Without Flashing Tray Icon
;Click on <f2> key - to do put the variables
;Click on <f3> key - to show if the variables is be Cleared
;Tip - if you change the Name Example1.ahk into Example2.ahk
;Then you can use ReplaceAll Function in Notepad - ReplaceAll Example1 to Example2
WriteReg_Example1("Suspend","0")
WriteReg_Example1("Exit","0")
mode=1
loop
{
;----------------
RegRead, x, HKEY_CURRENT_USER,software\Example1,Suspend ; read SuspendValue
if x=1
{
WriteReg_Example1("Suspend","0")
x=0
Suspend
}
;----------------
;----------------
RegRead, x, HKEY_CURRENT_USER,software\Example1,Exit ; read ExitValue
if x=1
{
exitapp
WriteReg_Example1("Exit","0")
x=0
}
;----------------
} ;End Loop
;if you have Many variables +-1000x and you want to clean them.
;you can use the Reload Command to empty them.
;but i do not want that the System Tray will be Flashing. and it will reordered all my other Tray icons.
;----------------------------------
#if mode
f1:: ;Restart script and clear all variables.
reload
return
f2::
a1 := 100
;a.... := ....
a1000 := 100
msgbox a1 = %a1% to a1000 = %a1000%
return
f3::
msgbox a1 = %a1% to a1000 = %a1000%
return
~esc::exitapp
#if
;----------------------------------
;----------------------------------
WriteReg_Example1(KeyName,KeyValue)
{
RegWrite, REG_SZ, HKEY_CURRENT_USER,software\Example1,%KeyName%,%KeyValue% ;write Registry for External Program
}
;---------------------------------
Example1Tray.ahk
;#Notrayicon
#Persistent
OnExit, DoExitExternal
#SingleInstance force
mode=1
;Tip - if you change the Name Example1.ahk into Example2.ahk
;Then you can use ReplaceAll Function in Notepad - ReplaceAll Example1 to Example2 and it is done!
WriteReg_Example1("Suspend","0")
WriteReg_Example1("Exit","0")
Menu, Tray, NoStandard ; Remove the Standard Menu items
Menu, Tray, Add , H&elp, DoHelp
Menu, Tray, Add , W&indow Spy, DoWindowSpy
Menu, Tray, Add , S&uspend Script, DoSuspendExternal
Menu, Tray, Add , E&xit, DoExitExternal
;----------------
#If WinNotExist Example1.ahk
{
run Example1.ahk
}
;----------------
loop
{
} ;End Loop
;----------------
DoHelp:
run C:\Program Files\AutoHotkey\AutoHotkey.chm
return
;----------------
;----------------
DoWindowSpy:
run C:\Program Files\AutoHotkey\AU3_Spy.exe
return
;----------------
;----------------
DoSuspendExternal:
WriteReg_Example1("Suspend","1")
if a=1
{
Menu, Tray, Icon , Shell32.dll, 29, 1
a=0
}else{
Menu, Tray, Icon, Shell32.dll, 132, 1
a=1
}
return
;----------------
;----------------
DoExitExternal:
WriteReg_Example1("Suspend","0")
WriteReg_Example1("Exit","1")
sleep 250
ExitApp
return
;----------------
;----------------------------------
WriteReg_Example1(KeyName,KeyValue)
{
RegWrite, REG_SZ, HKEY_CURRENT_USER,software\Example1,%KeyName%,%KeyValue% ;write Registry for External Program
}
;----------------------------------
;----------------------------------
#if mode
~esc::
gosub DoExitExternal
return
#if
;----------------------------------