I feel like I'm having a conversation with myself, but oh well. Attached is my tweaked version of Mr Creator's script. If you don't have outlook on your computer you will have to disable that part of the script.
Basic changes. Only Word, Excel, PDF, outlook messages, will show as wider buttons. Changed how the wording behaves. All other programs will show only an icon. I just need to know they are active. Added a clock and an unread message indicator. made it topmost and popup and overlay real toolbar. I think that's about it.
I wouldn't call what I've done an improvement, I'm too much a rookie to claim that I could improve one of Mr Creator's scripts. Anyways it works for me.
#include <GuiConstants.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
#include <GuiImageList.au3>
#include <Array.au3>
#include<Misc.au3>
#include <StaticConstants.au3>
_Singleton("taskbar.exe", 0)
;
AutoItSetOption("WinTitleMatchMode",2)
Opt("WinWaitDelay", 0)
Opt("GuiOnEventMode", 1)
$w = 196
$h = 17
Global $aButtons_IDs[100][3]
Global $nLast_MsgID = 0, $iLast_ActiveID = 0, $hLast_Active_Win = 0
$hGUI = GUICreate("", 1028, 26, 0, 742,$WS_POPUP, $WS_EX_TOPMOST)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Main_Events")
GUISetBkColor(0xAAAAAA)
$date = GUICtrlCreateButton("taskbar", 813, 1, 211, 25,BitOr($BS_PUSHLIKE, $BS_LEFT))
$unread = GUICtrlCreateLabel("Unread", 734, 1, 22, 25, $SS_RIGHT)
$unread2 = GUICtrlCreateLabel("Unread", 760, 0, 48, 25,$SS_LEFT)
_Init_TasksBar_Proc()
AdlibEnable("_Check_TasksBar_Synch_Proc", 300)
GUISetState(@SW_SHOWNOACTIVATE)
Update()
While 1
WEnd
Func _Main_Events()
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE
Exit
Case $aButtons_IDs[1][0] To $aButtons_IDs[$aButtons_IDs[0][0]][0]
$nLast_MsgID = @GUI_CtrlId
_Check_TasksBar_Synch_Proc()
EndSwitch
EndFunc
Func _Init_TasksBar_Proc()
Local $iLeft = 150, $sShortWinTitle, $sIcon_File, $iIcon_ID,$jIcon_ID, $iID, $jID, $jLeft = 10
local $count = ""
Local $aAppVisible_Wins = StringSplit(_WinListTaskBarWindows(), @CRLF, 1)
If @error And $aAppVisible_Wins[1] = "" Then Return 0
$hLast_Active_Win = 0
For $i = 1 To $aAppVisible_Wins[0]
$sShortWinTitle = _StringGetShortString($aAppVisible_Wins[$i], 23)
$sIcon_File = _WinGetIconFile($aAppVisible_Wins[$i])
$iIcon_ID = 0
If _WinGetClassName($aAppVisible_Wins[$i]) = "CabinetWClass" Then $iIcon_ID = 13
If _WinGetClassName($aAppVisible_Wins[$i]) = "OpusApp" or _WinGetClassName($aAppVisible_Wins[$i]) = "XLMAIN" or _WinGetClassName($aAppVisible_Wins[$i]) = "ExploreWClass" or _WinGetClassName($aAppVisible_Wins[$i]) = "AcrobatSDIWindow" or _WinGetClassName($aAppVisible_Wins[$i]) = "CabinetWClass" or _WinGetClassName($aAppVisible_Wins[$i]) = "rctrl_renwnd32" and WinGetTitle($aAppVisible_Wins[$i])<> "Inbox - Microsoft Outlook" then
$sized = 108
$iID = _GUICtrlCreateButton($sShortWinTitle, $iLeft, 2, $sized, 22, BitOr($BS_PUSHLIKE, $BS_LEFT), -1, $sIcon_File, $iIcon_ID)
_GUICtrlSetTheme($iID)
GUICtrlSetOnEvent($iID, "_Main_Events")
$aButtons_IDs[0][0] += 1
$aButtons_IDs[$aButtons_IDs[0][0]][0] = $iID
$aButtons_IDs[$aButtons_IDs[0][0]][1] = $aAppVisible_Wins[$i]
$aButtons_IDs[$aButtons_IDs[0][0]][2] = WinGetHandle($aAppVisible_Wins[$i])
If WinActive($aAppVisible_Wins[$i]) Then
$iLast_ActiveID = $iID
$hLast_Active_Win = $aButtons_IDs[$aButtons_IDs[0][0]][2]
GUICtrlSetState($iID, $GUI_CHECKED)
EndIf
$ileft += 110
else
$sized = 22
$jID = _GUICtrlCreateButton("", $jLeft, 2, $sized, 22, BitOr($BS_PUSHLIKE, $BS_LEFT), -1, $sIcon_File, $iIcon_ID)
_GUICtrlSetTheme($jID)
GUICtrlSetOnEvent($jID, "_Main_Events")
$aButtons_IDs[0][0] += 1
$aButtons_IDs[$aButtons_IDs[0][0]][0] = $jID
$aButtons_IDs[$aButtons_IDs[0][0]][1] = $aAppVisible_Wins[$i]
$aButtons_IDs[$aButtons_IDs[0][0]][2] = WinGetHandle($aAppVisible_Wins[$i])
If WinActive($aAppVisible_Wins[$i]) Then
$iLast_ActiveID = $jID
$hLast_Active_Win = $aButtons_IDs[$aButtons_IDs[0][0]][2]
GUICtrlSetState($jID, $GUI_CHECKED)
EndIf
$jLeft += 25
endif
Next
EndFunc
Func _Check_TasksBar_Synch_Proc()
Local $sAppVisible_Wins = _WinListTaskBarWindows() & @CRLF
Local $sTasksBar_Wins = "", $iTasksBar_Wins_Count = 0, $iAppVisible_Wins_Count = 0, $iWin_Active_Count = 0, $sCheck_Title
If $sAppVisible_Wins <> @CRLF Then
StringReplace($sAppVisible_Wins, @CRLF, "")
$iAppVisible_Wins_Count = @extended
EndIf
For $i = 1 To $aButtons_IDs[0][0]
If $aButtons_IDs[$i][0] = $nLast_MsgID Then
$iLast_ActiveID = $nLast_MsgID
If $hLast_Active_Win = $aButtons_IDs[$i][2] Then
$hLast_Active_Win = 0
_GUICtrlSetState($aButtons_IDs[$i][0], $GUI_UNCHECKED)
WinSetState($aButtons_IDs[$i][2], "", @SW_MINIMIZE)
;SoundPlay(@WindowsDir & "\Media\Windows Minimize.wav", 0)
Else
;$hLast_Active_Win = $aButtons_IDs[$i][2]
_GUICtrlSetState($aButtons_IDs[$i][0], $GUI_CHECKED)
WinActivate($aButtons_IDs[$i][2])
;SoundPlay(@WindowsDir & "\Media\Windows Restore.wav", 0)
EndIf
EndIf
$sCheck_Title = WinGetTitle($aButtons_IDs[$i][2])
If $sCheck_Title <> $aButtons_IDs[$i][1] Then
$aButtons_IDs[$i][1] = $sCheck_Title
GUICtrlSetData($aButtons_IDs[$i][0], _StringGetShortString($sCheck_Title, 23))
EndIf
$sTasksBar_Wins &= $aButtons_IDs[$i][1] & @CRLF
$iTasksBar_Wins_Count += 1
If WinActive($aButtons_IDs[$i][2]) Then
$hLast_Active_Win = $aButtons_IDs[$i][2]
_GUICtrlSetState($aButtons_IDs[$i][0], $GUI_CHECKED)
Else
_GUICtrlSetState($aButtons_IDs[$i][0], $GUI_UNCHECKED)
EndIf
Next
If $sTasksBar_Wins <> $sAppVisible_Wins And $iTasksBar_Wins_Count <> $iAppVisible_Wins_Count Then
For $i = 1 To $aButtons_IDs[0][0]
GUICtrlDelete($aButtons_IDs[$i][0])
Next
$aButtons_IDs = 0
Dim $aButtons_IDs[100][3]
_Init_TasksBar_Proc()
EndIf
$nLast_MsgID = 0
EndFunc
Func _WinListTaskBarWindows($sTitle="", $sText="", $iIgnoreTitlessWins=1)
Local $aWinList, $aWin_Pos, $sAppVisible_Wins = ""
If $sTitle <> "" Then
$aWinList = WinList($sTitle, $sText)
Else
$aWinList = WinList()
EndIf
For $i = 1 To $aWinList[0][0]
If $iIgnoreTitlessWins And $aWinList[$i][0] = "" Then ContinueLoop ;To ignore windows without titles
If $aWinList[$i][0] = "Program Manager" or $aWinList[$i][0] = "quick" or $aWinList[$i][0] = "Start" or $aWinList[$i][0] = "Shell_TrayWnd" Then ContinueLoop
;To ignore windows that is not visible to the eye

...
$aWin_Pos = WinGetPos($aWinList[$i][1])
If Not @error And $aWin_Pos[1] < (-$aWin_Pos[3])+5 And $aWin_Pos[0] <> -32000 Then ContinueLoop
;If _WinIsAppWindow($aWinList[$i][1]) And _WinIsVisible($aWinList[$i][1]) Then $sAppVisible_Wins &= $aWinList[$i][0] & @CRLF
If WinGetHandle($aWinList[$i][1]) <> $hGUI And _WinIsVisible($aWinList[$i][1]) Then _
$sAppVisible_Wins &= $aWinList[$i][0] & @CRLF
Next
Return StringStripWS($sAppVisible_Wins, 2)
EndFunc
Func _WinIsAppWindow($hWnd)
Local $iWindowStyle = _WinGetStyle($hWnd, 0)
Local $iWindowExStyle = _WinGetStyle($hWnd, 1)
Return _
BitAND($iWindowStyle, $WS_EX_APPWINDOW) = $WS_EX_APPWINDOW Or _
BitAND($iWindowExStyle, $WS_EX_APPWINDOW) = $WS_EX_APPWINDOW
EndFunc
Func _WinIsVisible($hWnd)
Return BitAND(_WinGetStyle($hWnd), $WS_VISIBLE) = $WS_VISIBLE
EndFunc
Func _WinGetStyle($hWnd, $iIndex=0)
Local Const $GWL_STYLE = -16, $GWL_EXSTYLE = -20
Local $iGWL_Index = $GWL_STYLE
If $iIndex > 0 Then $iGWL_Index = $GWL_EXSTYLE
Local $aStyles = DllCall('User32.dll', 'long', 'GetWindowLong', 'hwnd', $hWnd, 'int', $iGWL_Index)
Return $aStyles[0]
EndFunc
Func _WinGetClassName($hWnd)
If Not IsHWnd($hWnd) Then $hWnd = WinGetHandle($hWnd)
Local $aClassName = DLLCall("user32.dll", "int", "GetClassName", "hWnd", $hWnd, "str", "", "int", 256)
If Not @error And $aClassName[0] <> 0 Then Return $aClassName[2]
Return @error
EndFunc
Func _WinGetIconFile($sTitle, $sText="")
Local $iPID = WinGetProcess($sTitle, $sText)
If $iPID = -1 Then Return SetError(1, 0, 0)
Local $aProc = DllCall('Kernel32.dll', 'hwnd', 'OpenProcess', 'int', BitOR(0x0400, 0x0010), 'int', 0, 'int', $iPID)
If Not IsArray($aProc) Or Not $aProc[0] Then Return SetError(2, 0, -1)
Local $vStruct = DllStructCreate('int[1024]')
Local $hPsapi_Dll = DllOpen('Psapi.dll')
If $hPsapi_Dll = -1 Then $hPsapi_Dll = DllOpen(@SystemDir & '\Psapi.dll')
If $hPsapi_Dll = -1 Then $hPsapi_Dll = DllOpen(@WindowsDir & '\Psapi.dll')
If $hPsapi_Dll = -1 Then Return SetError(3, 0, '')
DllCall($hPsapi_Dll, 'int', 'EnumProcessModules', _
'hwnd', $aProc[0], _
'ptr', DllStructGetPtr($vStruct), _
'int', DllStructGetSize($vStruct), _
'int_ptr', 0)
Local $aRet = DllCall($hPsapi_Dll, 'int', 'GetModuleFileNameEx', _
'hwnd', $aProc[0], _
'int', DllStructGetData($vStruct, 1), _
'str', '', _
'int', 2048)
DllClose($hPsapi_Dll)
If Not IsArray($aRet) Or StringLen($aRet[3]) = 0 Then Return SetError(4, 0, '')
Return $aRet[3]
EndFunc
Func _GUICtrlSetTheme($hWnd, $iTheme=0)
If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
Local $aOld_Theme = DllCall("UxTheme.dll", "int", "GetWindowTheme", "hwnd", $hWnd)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $hWnd, "wstr", $iTheme, "wstr", 0)
Return $aOld_Theme[0]
EndFunc
Func _GUICtrlCreateButton($sText,$iLeft,$iTop,$iWidth=-1,$iHeight=-1,$nStyle=-1,$nExStyle=-1,$sIconFile='', $nIconID=0, $nAlign=-1)
Local $nID = GUICtrlCreateRadio($sText, $iLeft, $iTop, $iWidth, $iHeight, $nStyle, $nExStyle)
If $sIconFile = '' Then Return $nID
Local $hIL = _GUIImageList_Create(16, 16, 5, BitOr($ILC_MASK, $ILC_COLOR32), 0, 1)
Local $stIcon = DllStructCreate("int")
_WinAPI_ExtractIconEx($sIconFile, $nIconID, DllStructGetPtr($stIcon), 0, 1)
_GUIImageList_AddIcon($hIL, $sIconFile, $nIconID)
_GUIImageList_DestroyIcon(DllStructGetData($stIcon, 1))
Local $stBIL = DllStructCreate("dword;int[4];uint")
DllStructSetData($stBIL, 1, $hIL)
DllStructSetData($stBIL, 2, 1, 1)
DllStructSetData($stBIL, 2, 1, 2)
DllStructSetData($stBIL, 2, 1, 3)
DllStructSetData($stBIL, 2, 1, 4)
DllStructSetData($stBIL, 3, $nAlign)
GUICtrlSendMsg($nID, $BCM_SETIMAGELIST, 0, DllStructGetPtr($stBIL))
Return $nID
EndFunc
Func _GUICtrlSetState($iCtrlID, $sState)
If Not BitAND(GUICtrlRead($iCtrlID), $sState) Then GUICtrlSetState($iCtrlID, $sState)
EndFunc
Func _StringGetShortString($sString, $iShift = 0)
$sString = StringReplace($sString, "Microsoft Excel - ", "")
$sString = StringReplace($sString, " - Message (Rich Text)", "")
$sString = StringReplace($sString, " - Microsoft Word", "")
$sString = StringReplace($sString, " - Microsoft Outlook", "")
Local $iString = StringLen($sString),$maxlength = 10
If $iString <= $maxlength Then Return $sString
Local $sMidl= "...", $iMidl = StringLen($sMidl)
Local $iCut = ($iString - $maxlength)
$sString = StringLeft($sString, $iCut) & $sMidl
Return $sString
EndFunc
Func Update()
While 1
$h = @HOUR
$m = @MIN
If $h > 12 Then
$h = $h - 12
$m = $m & " PM"
Else
If $h = 12 Then
$m = $m & " PM"
Else
$m = $m & " AM"
EndIf
EndIf
GUICtrlSetFont($date,13,"Franklin Gothic Medium")
GUICtrlSetData($date, GetDayOfWeek() & " " & GetMonth() & " " & @MDAY & "/" & Getyear() & " " & $h & ":" & $m)
$otl = ObjCreate("Outlook.Application")
$session = $otl.GetNameSpace("MAPI")
$inbox = $session.GetDefaultFolder(6)
$c=0
For $m In $inbox.items
If $m.unread Then $c = $c + 1
Next
$session.logoff
$s = "s"
If $c = 1 Then $s = ""
GUICtrlSetFont($unread,15,"Franklin Gothic Medium")
GUICtrlSetData($unread,$c)
GUICtrlSetFont($unread2,8,"Franklin Gothic Medium")
GUICtrlSetData($unread2," unread message" & $s)
Sleep(15000)
WEnd
EndFunc
Func GetDayOfWeek()
$a = @WDAY
If $a = 1 Then Return "Sun"
If $a = 2 Then Return "Mon"
If $a = 3 Then Return "Tues"
If $a = 4 Then Return "Wed"
If $a = 5 Then Return "Thurs"
If $a = 6 Then Return "Fri"
If $a = 7 Then Return "Sat"
EndFunc
Func GetMonth()
$a = @MON
If $a = 1 Then Return "Jan"
If $a = 2 Then Return "Feb"
If $a = 3 Then Return "Mar"
If $a = 4 Then Return "Apr"
If $a = 5 Then Return "May"
If $a = 6 Then Return "June"
If $a = 7 Then Return "July"
If $a = 8 Then Return "Aug"
If $a = 9 Then Return "Sept"
If $a = 10 Then Return "Oct"
If $a = 11 Then Return "Nov"
If $a = 12 Then Return "Dec"
EndFunc
Func Getyear()
$a = @YEAR
If $a = 2009 Then Return "09"
If $a = 2010 Then Return "10"
If $a = 2011 Then Return "11"
EndFunc