AutoHotkey Community

It is currently May 27th, 2012, 12:50 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Show desktop launcher
PostPosted: December 25th, 2009, 12:53 pm 
Offline
User avatar

Joined: April 4th, 2009, 8:19 pm
Posts: 1143
Location: Croatia
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!
:)


Last edited by Learning one on July 13th, 2011, 10:25 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 27th, 2009, 9:48 am 
Offline

Joined: October 28th, 2006, 5:01 pm
Posts: 58
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 28th, 2009, 3:34 pm 
Offline
User avatar

Joined: April 4th, 2009, 8:19 pm
Posts: 1143
Location: Croatia
@netfun81: :)


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Cristi® and 10 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group