Page 1 of 1

Get a TrayTip whenever your script is reloaded

Posted: 06 Feb 2018, 19:21
by aph

Code: Select all

; Description: Get a TrayTip whenever your script is reloaded
; Permalink: https://autohotkey.com/boards/viewtopic.php?t=43865
; Author: aph
; Version: 0.1
FileGetAttrib, attribs, %A_ScriptFullPath%
if (attribs="A") {
   FileSetAttrib, -A, %A_ScriptFullPath%
   TrayTip, Reloaded script, %A_ScriptFullPath%,, 1
}
OnExit, ExitSub
Return
ExitSub:
   if (A_ExitReason="Reload") {
       FileSetAttrib, +A, %A_ScriptFullPath%
   }
ExitApp
For example, works well with:

Code: Select all

; Alt+Shift+R to reload AutoHotkey script
+!r::Reload

Re: Get a tray tooltip whenever your script is reloaded

Posted: 07 Feb 2018, 02:10
by SL5
whats you question?
you want a "tray tooltip" ?

Re: Get a tray tooltip whenever your script is reloaded

Posted: 08 Feb 2018, 19:47
by aph
No question. I corrected "tray tooltip to clarify that this code gives you a TrayTip whenever the Reload command is issued.

Normally this would not be possible since since AHK is reloading, removing all its widgets.

By temporarily toggling the archive attribute on the currently running script when it exits due to a reload, we can issue a TrayTip when it loads again.

Re: Get a TrayTip whenever your script is reloaded

Posted: 12 Feb 2018, 04:24
by lexikos
Why modify the file's attributes?

You can detect whether the script was reloaded by looking at its command line.