MrCreatoR Posted December 30, 2008 Share Posted December 30, 2008 Hi,The idea was inspired by this thread.ScreenShot:Known Issues:1) Sometimes the minimize/maximize operation (by TaskBar button clicks) not working properly.2) Icons of the windows not extracted properly (i didn't find any correct way of doing it).3) The TaskBar windows sometimes does not recognized properly (i am not sure what is the right method to check APP_WINDOW ExStyle).4) There is SoundPlay() commented out because of bugged reaction on minimize/maximize.What could/can be added to the project:* Shell Context Menu to manage the window (move/minimize/maximize/restore/close etc.).* TaskBar window docking.* Skin the TaskBar .* Time display.* System icons.* Transparency.* Mp3 Player, Cofee Blender... sorry, carried away .* And much more...Download: TasksBar_Demo.au3Enjoy! Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
FireFox Posted December 30, 2008 Share Posted December 30, 2008 (edited) @MrCreator Great stuff and it looks nice Keep it up Cheers, FireFox. Edited December 30, 2008 by FireFox Link to comment Share on other sites More sharing options...
yehia Posted December 30, 2008 Share Posted December 30, 2008 GJ this really look nice @FireFox ur avatar is killing meh My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine Link to comment Share on other sites More sharing options...
FireFox Posted December 30, 2008 Share Posted December 30, 2008 @yehia I like killing eveybody Cheers, FireFox. Link to comment Share on other sites More sharing options...
picea892 Posted January 20, 2009 Share Posted January 20, 2009 MrCreatoR this is exactly what I'm looking for! I'm new to autoit and find it extremely powerful but perhaps a little less intuitive than HTML and Vbscript. I made an HTA taskbar with html, javascript and vbscript. It uses icons instead of words and has dropdown menus instead of where the quicklaunch bar was. Recently went full bore and designed a custom desktop and killed explorer.exe and used a file manager replacement. The end result, a customized taskbar and a blank desktop. I'm a minimalist at heart, especially when I'm working....... Now getting into autoit, I've really enjoying the language and have been wondering if I could redo the whole shebang in autoit and here you go and get me half way there! I hope I can learn the language well enough to build on your success here. Thanks Link to comment Share on other sites More sharing options...
rasim Posted January 20, 2009 Share Posted January 20, 2009 @MrCreatoRLooks very nice! Keep up your good work, my friend! Link to comment Share on other sites More sharing options...
picea892 Posted January 22, 2009 Share Posted January 22, 2009 Hi again I was wondering if I could make a request Mr. Creator. Could you figure out a way to sort the buttons, ideally by memory usage size. I was able to do it in vbscript for my HTA using WMI and an ADOR recordset. I'm just not familar enough with Autoit to do it. Here is my VBscript, if it would help. I understand that it can be converted to autoit somehow.........Thanks Set objWMI = GetObject("winmgmts:\\.\root\CIMV2") 'Setup variables Set adoRS = CreateObject("ADOR.Recordset") adoRS.Fields.Append "ProcessName", 200, 255 adoRS.Fields.Append "ProcessSet", 5 adoRS.Open 'Open recordset Set objProc = objWMI.ExecQuery("SELECT * FROM Win32_Process") For Each Process In objProc adoRS.AddNew adoRS("ProcessName") = Process.Name adoRS("ProcessSet") = Process.WorkingSetSize / 1024 adoRS.Update Next adoRS.Sort = "ProcessSet" adoRS.MoveLast Do Until AdoRS.BOF = True CREATE THE BUTTONS IN THIS DO LOOP adoRS.MovePrevious loop adoRS.Close Set adoRS = Nothing Set objWMI = Nothing Set objProc = Nothing Link to comment Share on other sites More sharing options...
picea892 Posted February 7, 2009 Share Posted February 7, 2009 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. CODE#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 Link to comment Share on other sites More sharing options...
Shanheavel Posted April 16, 2011 Share Posted April 16, 2011 Hi! I know it's old topic but I want to create my own taskbar. How can I get icons with bigger size (e.g for 48x48)? If I change _GUIImageList_Create(16, 16, 5, BitOr($ILC_MASK, $ILC_COLOR32), 0, 1) for _GUIImageList_Create(48, 48, 5, BitOr($ILC_MASK, $ILC_COLOR32), 0, 1) images are blurry (you see pixels). Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now