Above is a screenshot of a script I am working on which displays the system time in the title bar area, along with remote buttons for Winamp (though I'm using fb2k now. ). More icons can be added to launch programs, commands (FileRecycleEmpty for example) scripts etc. I'm hoping to implement a context menu of sorts at some point.
Tip- if you link an icon to ShortPopUp in the script the menu will appear near the icon clicked.
Get the icons here.
Changelog:
Added right-click context menu. (currently works with ahk_class not screen coords, so not perfect.)
Replaced Gui, Destroy approach with SetTimer (thanks toralf!)
Improved Date/Time section to toggle show/hide display properties view via tray icon.
Heres the script so far (you'll need AutoHotkey v1.0.26+ for this script to work):
; titlebar clock/remote control/launcher script by Serenity ; specify the path to winamp here: path = d:\winamp\winamp.exe #singleinstance ;______________________ ; tray menu here menu, tray, icon, Clock.ico, 1 menu, tray, tip, titlebar clock Menu, Tray, NoStandard ; only use this menu Menu, Tray, Click, 1 ; Remove this line if you prefer double-click vs. single-click. Menu, Tray, Add, &Date/Time, Datetime Menu, Tray, Default, &Date/Time Menu, Tray, Add ; separator Menu, Tray, Add, &Reload, Reload Menu, Tray, Add, E&xit, Exit ;______________________ ; gui ctx menu here Menu, ctx, Add, &1, entry1 Menu, ctx, Add, &2, entry2 Menu, ctx, Add, &3, entry3 Menu, ctx, Add, &4, entry4 Menu, ctx, color, FFFFFF ;______________________ ; gui here FormatTime, TimeString, , hh:mm - ddd, dd MMM ; put the time and date into the window title Gui, +ToolWindow +AlwaysOnTop -SysMenu Gui, -Caption ; use this to remove the tooltip top! Gui, Color, CCCCCC Gui, Add, Picture, gwinamp x3 y0, h_winamp.ico Gui, Add, Picture, gprev x+3 y0, h_prev.ico Gui, Add, Picture, gplay x+3 y0, h_play.ico Gui, Add, Picture, gpause x+3 y0, h_pause.ico Gui, Add, Picture, gstop x+3 y0, h_stop.ico Gui, Add, Picture, gnext x+3 y0, h_next.ico Gui, Font, cFFFFFF s6 wbold, terminal Gui, Add, Text, vTxtCurrentTime x+10 y5, %TimeString% Gui, Show, AutoSize NoActivate xcenter y0 h18 w240, %TimeString% ; NoActivate avoids deactivating the currently active window. ; Autosize prevents longer time formats from being clipped. WinSet, TransColor, CCCCCC 255, ahk_class AutoHotkeyGUI SetTimer, AdjustTime, 60000 return AdjustTime: FormatTime, TimeString, , hh:mm - ddd, dd MMM ; put the time and date into the window title GuiControl, , TxtCurrentTime, %TimeString% Gui, Show, NoActivate h18 w240, %TimeString% return ;______________________ ; icons functions winamp: postmessage, 0x111, 40258,,, ahk_class Winamp v1.x ; toggle main window return prev: PostMessage, 0x111, 40044,,, ahk_class Winamp v1.x return play: PostMessage, 0x111, 40045,,, ahk_class Winamp v1.x return pause: PostMessage, 0x111, 40046,,, ahk_class Winamp v1.x return stop: PostMessage, 0x111, 40047,,, ahk_class Winamp v1.x return next: PostMessage, 0x111, 40048,,, ahk_class Winamp v1.x return ;______________________ ; ctx menu entries entry1: entry2: entry3: entry4: SoundPlay, blip.wav return ;______________________ ; ctx menu mouse handler RButton:: MouseGetPos,,, MouseWin WinGetClass, MouseClass, ahk_id %MouseWin% if MouseClass in AutoHotkeyGUI ; Mouse is in gui { Menu, ctx, show return } ; else do normal right-click MouseClick, right,,,,, D KeyWait, RButton ; Wait for the user to physically release the button. MouseClick, right,,,,, U ; Release it logically to match. return ;______________________ ; tray menu entries Datetime: IfWinExist, Date/Time Properties WinClose else run, C:/WINNT/system32/timedate.cpl return Reload: reload return Exit: exitapp ;______________________ ; hotkeys ~^R::reload