AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Show desktop launcher

 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Learning one



Joined: 04 Apr 2009
Posts: 1000
Location: Croatia

PostPosted: Fri Dec 25, 2009 11:53 am    Post subject: Show desktop launcher Reply with quote

If your desktop is full of icons (shortcuts) and you launch your applications/files by clicking on them,
this is a script for you.

Please read description in script. Change settings in "settings" section.
By default, script hides all your desktop icons. Don't be scared, icons will show again when you press & hold %ShowDeskHotkey% or ExitApp.
You can check/uncheck Hide desktop icons in tray menu.

For maximum efficiency;
1) place you desktop icons around center of desktop
2) set CenterMouseOnShow = 1 and ReturnMouseTo = Initial position

This script is Radial menu co-product. Similar goal realized on simpler way.
If you like it or have some suggestions post reply.


Show desktop launcher
Code:
#NoEnv
CoordMode, mouse, screen

;===Description=========================================================================
/*
Show desktop launcher      by Learning one

Minimizes all windows when you press & hold defined mouse hotkey (RButton by default).
Release mouse button above desktop icon to launch it (and unminimize windows), or anywhere else to unminimize windows.
Hotkey can be any key, not just mouse button. Hotkey combinations are not supported!

Desktop will show after %ShowDeskDelay% miliseconds. To show it instantly, set 0. This delay gives you opportunity to send normal RButton click.
THE BEST THING TO DO is to change hotkey to XButton1 or XButton1 and use ShowDeskDelay = 0.

LICENCE:
Free for non-commercial, personal use.
For commercial use, e-mail me please.
Do not (re)distribute without my permission!
Author:      Boris Mudrinic (Learning one on AHK forum)
Contact:   http://www.autohotkey.net/~Learning%20one/Learning%20one%20contact.png

*/



;===Settings============================================================================
ShowDeskHotkey = RButton   ; Show desktop hotkey
ShowDeskDelay = 220         ; Show desktop delay

AutoHideIcons = 1         ; If 1, script hides all your desktop icons. Icons will be shown again when you press & hold %ShowDeskHotkey% or ExitApp
ClickCount = 2            ; If your computer is set to "double click to open item" (default) specify 2. If it is set to "single click to open item" specify 1.

CenterMouseOnShow =                ; If 1, mouse will be moved to the center of screen after %ShowDeskHotkey%. Ahything else will not move mouse.
ReturnMouseTo = center               ; Returns mouse to specified position when you release %ShowDeskHotkey%.
                              ; Allowed values: "Initial position", "center", or anything else --> doesn't move mouse




;===Auto-execute end====================================================================
OnExit, ExitSub
XCenter := A_ScreenWidth/2, YCenter := A_ScreenHeight/2
ControlGet, hwnd, Hwnd,, SysListView321, ahk_class Progman

Menu, tray, add
Menu, tray, add, Hide desktop icons, HideIcons
if AutoHideIcons = 1
{
   WinHide, ahk_id %hwnd%
   Menu, tray, Check, Hide desktop icons
}

Hotkey, %ShowDeskHotkey%, ShowDeskHotkey
Return



;===ShowDeskHotkey Subroutine===========================================================
ShowDeskHotkey:
QuitShowDesk =
MouseGetPos, InitialX, InitialY, ActiveWin
SetTimer, QuitShowDesk, 20   

While (A_TimeSinceThisHotkey < ShowDeskDelay or QuitShowDesk ! 1)
Sleep, 20
SetTimer, QuitShowDesk, off

if QuitShowDesk = 1
Return

if CenterMouseOnShow = 1
MouseMove, %XCenter%, %YCenter%

WinMinimizeAll

if AutoHideIcons = 1
WinShow, ahk_id %hwnd%

KeyWait, %ShowDeskHotkey%, u

BlockInput, MouseMove
MouseClick, Left,,, %ClickCount%
BlockInput, MouseMoveOff

if ReturnMouseTo = Initial position
MouseMove, %InitialX%, %InitialY%
else if ReturnMouseTo = center
MouseMove, %XCenter%, %YCenter%

if AutoHideIcons = 1
WinHide, ahk_id %hwnd%

WinMinimizeAllUndo

Return



;===Subroutines=========================================================================
QuitShowDesk:
if not (GetKeyState(ShowDeskHotkey,"p"))
{
   SetTimer, QuitShowDesk, off
   QuitShowDesk = 1
   SendInput, {%ShowDeskHotkey%}
}
Return


HideIcons:
if AutoHideIcons = 1
{
   Menu, tray, Uncheck, Hide desktop icons
   AutoHideIcons =
   WinShow, ahk_id %hwnd%
}
Else
{
   Menu, tray, Check, Hide desktop icons
   AutoHideIcons = 1
   WinHide, ahk_id %hwnd%
}
Return


ExitSub:
WinShow, ahk_id %hwnd%
ExitApp


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Escape::ExitApp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


Merry Christmas!
Smile


Last edited by Learning one on Wed Jul 13, 2011 9:25 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
netfun81



Joined: 28 Oct 2006
Posts: 58

PostPosted: Sun Dec 27, 2009 8:48 am    Post subject: Reply with quote

nice, I like it. I was doing something similar with this script:

Code:

mbutton::
WinGet, id, list,,, Program Manager
      Loop, %id%
      {
         StringTrimRight, this_id, id%a_index%, 0
         WinGetTitle, title, ahk_id %this_id%
         WinGetClass, class, ahk_id %this_id%
         WinHide, ahk_id %this_id%
         HWins = %HWins%||%this_id%
       }
      Return
   
mbutton & rbutton::
      Loop, Parse, HWins, ||
         WinShow, ahk_id %A_LoopField%
      Return


But I guess if one doesnt care about hiding windows this works too:
Code:

mbutton::WinMinimizeAll
mbutton & rbutton::WinMinimizeAllUndo
Back to top
View user's profile Send private message
Learning one



Joined: 04 Apr 2009
Posts: 1000
Location: Croatia

PostPosted: Mon Dec 28, 2009 2:34 pm    Post subject: Reply with quote

@netfun81: Smile
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group