picea892 Posted March 12, 2009 Posted March 12, 2009 (edited) Minor edits:April 05th, 2009 - Fixed clock, winexist error[FINAL UPDATE: APRIL 02, 2009] Entire script rewritting using GDI+ and layering. This version has grouped buttons and eye candy. hover and press left and right buttons, Alt+# or simply use mouse wheel to navigate windows. Due to the significant change in this script, I am leaving the previous version up if some prefers that one. Feedback always appreciatedPicea;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;March 27th UpdateI am quite pleased at how the new window preview turned out. If you have taken a look at this script before, I strongly encourage you to try it again.Improvements (see screenshot for summary):1) Icon button hover generates window previewOn window preview - Right click black taskbar turns off always on top - Left click black taskbar turns on always on top - Left click red X closes window - Left click preview toggles restore/maximize - Right click preview minimizes2) Alt+# will activate window of corresponding icon3) Shift+Click Icon button will open new program (from same exe)4) Left click Icon button will activate window5) Right click icon button will minimize window6) Minimized windows will only show black taskbar and close button. Clicking on the fake taskbar will behave as is you clicked on preview (minimize, toggle state)7) Now sorted by process nameI attempted to make this program fast and low on resources, so previews are only refreshed when a window is opened or closed or a window is activated from a minimized state via a button or alt key.One think you might note. Clicks are checked for every 100 ms. Apparently I sometimes click faster than this and it doesn't register. This is easily changed, but if set to 50ms will likely change the CPU usage from 0% to 3 or 4%One last tip. Put this script in it's own folder. It will generate temporary jpg files of each window and save it to the script directory. If you run it from the desktop you will have some temp files to clean up I think that is about it. As always, please suggest new ideas, better methods or grab it and run with it and tweak as you like. I tried to keep the code well commented and easy to followEnjoy!------------------------------------------------------------------------------------------------------------------------------Previous updates.UPDATED March 13thSignificant Update March 15thHi everyoneThis is my first script that I have posted to the forum. It was inspired by Mr. Creator's Imitation Taskbar. I was unable to tweak his script the way I wanted to and so made my own. What does it do?The latest update of March 15th is a significant improvement and a bit of a rewrite. I believe it works flawlessly now.Features:1) Alt+Number will activate window associated with icon or minimize window if presently active.2) Mouse hover of icons will now result in a "peek" experience and produce a tooltip. If the window associated with the icon is not minimized, all other windows become semi-transparent and the window is shown.3) Left click icon activates window, right click icon to minimize window4) Icons are sorted by memory usage5) Ctrl+Shift+` will exit script6) To refresh icons press ` Otherwise icons only refreshed when window opened or closed.Again, I could have muddied the waters and added many _ispresseds and hotkeysets but I want to keep this pure for simplicity. I experimented with grouping icons the way Windows 7 does it and have had some success, though it's not completed. I'm undecided whether that is good funtionality or not.I would love thoughts on improvements/requests or if someone wants to take the bull by the horns and do it, even better. This will likely be the last update for a while. I have to use it for a while to see how it can be improved.Finally, I want the community to know there are portions of this script that I obtained from the forums. I would give credit to those individuals now. Pieces I did not create:1) Mask to hide GUI2) Process get icon3) the winlist exclusions list method which everything is built upon.4) The great code provided below.I hope you like it as much as I do, look forward to seeing whatever tweaks people will make. I have never used windows 7 beta so don't know close or far I am.ThanksupdatesPicV1.au3finalversion2.zip Edited April 6, 2009 by picea892
picea892 Posted March 12, 2009 Author Posted March 12, 2009 Here you go. Not really much to look at. Should mention I developed it for Windows XP so not sure how it will behave on Vista
FireFox Posted March 12, 2009 Posted March 12, 2009 @picea892 Its a good idea, its just the start; i think i will add some features, improvements on it Cheers, FireFox.
GEOSoft Posted March 12, 2009 Posted March 12, 2009 (edited) The best part of Windows 7 is the taskbar, hands downSome people might disagree with that. It's okay at high resolution but otherwise it's not great. Under any circumstaces it's not as good as what the Mac uses. Edited March 12, 2009 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
James Posted March 12, 2009 Posted March 12, 2009 Some people might disagree with that. It's okay at high resolution but otherwise it's not great. Under any circumstaces it's not as good as what the Mac uses.Someone had to mention that. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Achilles Posted March 13, 2009 Posted March 13, 2009 (edited) Works decent... Here's some suggestions: -Have it adapt to screen size, with my 1680x1050 this thing was sitting a little below the middle of my desktop -Add tooltips over the buttons that display the full name of the window Edit: Here's a better GetYear() function: Return StringRight(@YEAR, 2) Edited March 13, 2009 by Achilles My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
WideBoyDixon Posted March 13, 2009 Posted March 13, 2009 (edited) This is very nice. I hope you continue to work on and improve it. One thing I did notice is that you're using multiple windx() functions when you could just use one and check the @HotKeyPressed value to determine which application to activate. Something like this: If $aRetWinList[0][1] < 10 And $aRetWinList[0][1] > 1 Then HotKeySet("!" & $i, "windx") If $aRetWinList[0][1] = 10 Then HotKeySet("#0", "windx") ... Func windx() If @HotKeyPressed = "#0" Then WinActivate($aRetWinList[2][0], "") Else WinActivate($aRetWinList[Int(StringMid(@HotKeyPressed, 2, 1))][0], "") EndIf EndFuncoÝ÷ Ø l ay2¢ç(ºW[y¦â¶j+yçßÈÜ"¶¨º·ZÊðyé&¢{ajwryªßºw-ìjw`zÛazh§¶«m©à¹¨~ßç·Ý«¢+ÙÕ¹Ñå=]¬ ¤(%IÑÕɸ}]¥¹A%}Ñ1½±%¹¼¡}]¥¹A%}ÑUÍÉÕ±Ñ1 % ¤°Ðä¬5½¡]d¬Ô°Ü¤¤)¹Õ¹ìôôÐíÑå=]¬()Õ¹Ñ5½¹Ñ ¤(%IÑÕɸ}]¥¹A%}Ñ1½±%¹¼¡}]¥¹A%}ÑUÍÉÕ±Ñ1 % ¤°Øܬ5=8¤)¹Õ¹ìôôÐíÑ5½¹Ñ ()Õ¹ÑåÈ ¤(%IÑÕɸMÑÉ¥¹I¥¡Ð¡eH°È¤)¹Õ¹ìôôÐíÑåÈ()Õ¹}]¥¹A%}Ñ1½±%¹¼ ÀÌØí1½±°ÀÌØí1 QåÁ¤(%1½°ÀÌØíIÍÕ±Ðô±± ±° ÅÕ½Ðíɹ°Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÅÕ½ÐíÑ1½±%¹¼ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØí1½±°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØí1 QåÁ°ÅÕ½ÐíÁÑÈÅÕ½Ðì°À°ÅÕ½Ðí±½¹ÅÕ½Ðì°À¤(%%ÉɽÈQ¡¸IÑÕɸMÑÉÉ½È Ä°À°ÅÕ½ÐìÅÕ½Ðì¤(%1½°ÀÌØí±Á ÕÈô±±MÑÉÕÑ ÉÑ ÅÕ½Ðí¡ÉlÅÕ½ÐìµÀìÀÌØíIÍÕ±ÑlÁtµÀìÅÕ½ÐítÅÕ½Ðì¤($ÀÌØíIÍÕ±Ðô±± ±° ÅÕ½Ðíɹ°Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÅÕ½ÐíÑ1½±%¹¼ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØí1½±°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØí1 QåÁ°ÅÕ½ÐíÁÑÈÅÕ½Ðì°±±MÑÉÕÑÑAÑÈ ÀÌØí±Á ÕȤ°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÀÌØíIÍÕ±ÑlÁt¤(%%ÉɽÈ=È ÀÌØíIÍÕ±ÑlÁtôÀ¤Q¡¸IÑÕɸMÑÉÉ½È Ä°À°ÅÕ½ÐìÅÕ½Ðì¤(%IÑÕɸMÑÉÉ½È À°À°±±MÑÉÕÑÑÑ ÀÌØí±Á ÕȰĤ¤)¹Õ¹()Õ¹}]¥¹A%}ÑUÍÉÕ±Ñ1 % ¤(%1½°ÀÌØíIÍÕ±Ðô±± ±° ÅÕ½Ðíɹ°Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí±½¹ÅÕ½Ðì°ÅÕ½ÐíÑUÍÉÕ±Ñ1 %ÅÕ½Ðì¤ìÐÑ¡Õ±Ð1 %½ÈÑ¡¥ÌÕÍÈ(%%ÉɽÈQ¡¸IÑÕɸMÑÉÉ½È Ä°À°À¤(%IÑÕɸMÑÉÉ½È À°À°ÀÌØíIÍÕ±ÑlÁt¤)¹Õ¹ Regards, WBD Edited March 13, 2009 by WideBoyDixon [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center]
Kip Posted March 13, 2009 Posted March 13, 2009 The best part of Windows 7 is the taskbar,Did you mean: The worst part? MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
picea892 Posted March 13, 2009 Author Posted March 13, 2009 Hi again Thanks for such great ideas and code. I have made the alterations asked for (see original post) The Tooltip was actually a bit of a challenge. Since the buttons can change ever 300ms I couldn't use the GUICTRLSETTIP function so used tooltips. My toolbar was picking up the tooltip so had to isolate the handle and exclude. A problem I've noticed but am having difficulty fixing is when you have all but one window minimized you can't minimize the last window. I'll look into it further this weekend. Thanks again
picea892 Posted March 15, 2009 Author Posted March 15, 2009 Script works flawlessly now and has many new functions including a "peek" clone. Likely will be the last update for a while. Enjoy
James Posted March 15, 2009 Posted March 15, 2009 New screenshot? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
picea892 Posted March 15, 2009 Author Posted March 15, 2009 (edited) Okay Original post edited. New screenshot showing peek and toolbar added Edited March 15, 2009 by picea892
James Posted March 15, 2009 Posted March 15, 2009 Instead of the date being a button, can it not be a label? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
picea892 Posted March 15, 2009 Author Posted March 15, 2009 Instead of the date being a button, can it not be a label?Sure could, just change line 16 to this$date = GUICtrlCreatelabel("taskbar", @DesktopWidth-221, 8, 211, 25,$SS_SUNKEN)Maybe I'm not artistic enough, but never have much luck in making labels look very nice. If you have a nice looking label format, colour etc. Please share.I guess boring gray buttons get old fast
Kip Posted March 16, 2009 Posted March 16, 2009 The best part of the windows 7 taskbar are the visuals, and that's missing here. I advise you to use this script to do that: expandcollapse popup#include <GDIPlus.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> _GDIPlus_Startup() $pngSrc = @ScriptDir & "\LaunchySkin.png" $GUI = _GUICreate_Alpha("Title", $pngSrc) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd _GDIPlus_Shutdown() Func _GUICreate_Alpha($sTitle, $sPath, $iX=-1, $iY=-1, $iOpacity=255) Local $hGUI, $hImage, $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hImage = _GDIPlus_ImageLoadFromFile($sPath) $width = _GDIPlus_ImageGetWidth($hImage) $height = _GDIPlus_ImageGetHeight($hImage) $hGUI = GUICreate($sTitle, $width, $height, $iX, $iY, $WS_POPUP, $WS_EX_LAYERED) $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", $width) DllStructSetData($tSize, "Y", $height) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", 1) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, 2) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteObject($hImage) _WinAPI_DeleteDC($hMemDC) EndFunc;==>SetBitmap (lod3n) MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
picea892 Posted March 16, 2009 Author Posted March 16, 2009 Hi Kip Thanks for your interest and for the script. It's a quick and easy demo of alpha blending. I looked into the functions a bit more using the forum and the helpfile and did some fiddling with it. I'm starting to think from this research that this script would only work on a png. Do you think this is right? The only way I could see this working would be to extract the icon from the exe and save it to a temp file as a png. I have no clue how one would do this and seems that every post on the forum points to external programs as the solution. Am I missing something, can you point me in the right direction if I am? Below is a barebones script I was playing with, just so you can see what I am talking about. Make sure notepad is open and the turn on and off the four lines I flagged. Picea Ps: I have to agree that this is missing the eye candy of Windows 7. It would be great to add some of that.....somehow. CODE#include <Array.au3> #include <Winapi.au3> #include<Misc.au3> #include <Process.au3> #include <StaticConstants.au3> #include <GuiConstants.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GDIPlus.au3> _GDIPlus_Startup() $pngSrc = _ProcessGetIcon(_ProcessGetName (WinGetProcess ("Untitled - Notepad"))) GUISetIcon($pngSrc) ;MsgBox(0,"",$pngSrc) ; Make sure notepad is open first ;;;;;;;;;;;Turn these one for alpha blending way (Not working);;;;;;;;;;;;;;;;;; ;$GUI = _GUICreate_Alpha("Title", $pngSrc) ;$n1 = GUICtrlCreateIcon($pngSrc, -1, 0, 0, 32, 32) ;;;;;;;;;;;;;;;End;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;turn these on for old way;;;;;;;;;;;;;;;;;;;;;;;; $hGUI = GUICreate("", @DesktopWidth, 34,10,@DesktopHeight-35, $WS_POPUP) $button=GUICtrlCreateRadio("", @DesktopWidth-215, 0, 205, 32,BitOr($BS_PUSHLIKE, $BS_ICON)) ;;;;;;;;;;;;;;;;;;;;;;;;End;;;;;;;;;;;;;;;;;;;;;;;; GUICtrlSetImage(-1, $pngSrc, 0) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd _GDIPlus_Shutdown() Func _ProcessGetIcon($vProcess) Local $iPID = ProcessExists($vProcess) If Not $iPID Then Return SetError(1, 0, -1) 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 _GUICreate_Alpha($sTitle, $sPath, $iX=-1, $iY=-1, $iOpacity=235) Local $hGUI, $hImage, $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hImage = _GDIPlus_ImageLoadFromFile($sPath) $width = _GDIPlus_ImageGetWidth($hImage) $height = _GDIPlus_ImageGetHeight($hImage) $hGUI = GUICreate($sTitle, @DesktopWidth, 34,10,@DesktopHeight-35, $WS_POPUP, $WS_EX_LAYERED) $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", 32) DllStructSetData($tSize, "Y", 32) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", 1) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, 2) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteObject($hImage) _WinAPI_DeleteDC($hMemDC) EndFunc;==>SetBitmap (lod3n)
picea892 Posted March 27, 2009 Author Posted March 27, 2009 Hi everyone I made some pretty neat updates to this script. Please take a look and give me some advice, thoughts on what it needs......I know it needs eye candy. I'm struggling with that. But the window preview is a good start. Here's a screenshot to get your interest. Picea
picea892 Posted April 2, 2009 Author Posted April 2, 2009 I have completely reworked the script as per Kip's direction. It now uses GDI+, layered windows and the launchy png. It now has eye candy, grouped buttons and maintains the minimalistic look. The toolbar grows and shrinks to accomodate the number of buttons. I need to thank everyone in the GUI forum who answered my questions and provided great example scripts. Especially Malkey and Yashied. Thanks for the help. Picea
picea892 Posted April 3, 2009 Author Posted April 3, 2009 (edited) I've noticed a problem, which I thought I'd let people know. The clock only refreshes when a window is opened and closed. I could set it to refresh once a minute quite easily but the entire toolbar would refresh and make a noticeable flash. I have no other solution to the problem. How do you refresh one guictrl on a layer and none of the others. Anyways if anyone has ideas....... ;;;;;;;;;;;;;;;;;;;;;;;;;;;; I must of been tired yesterday. Anyways the solution is to add this to the while 1 loop $refreshing=1+$refreshing if $refreshing=30 then $wactive=WinGetHandle("","") $a="" GUISetIcon($a) if @DesktopHeight=1024 then $b=0 Else $b=18 EndIf GUICtrlDelete($test) $test = GUICtrlCreateIcon('', 0, 28, $b, 100, 64) Setdate($test, 0x373737, $a, 0, 70, 32,Update()) ;refresh() WinActivate($wactive,"") $refreshing=1 EndIf also need to set a global $refreshing=1, $test I'm not going to tweak the first post for this minor change and leave it to the user to make this change. Edited April 3, 2009 by picea892
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