Jump to content

1st script: double-click desktop


klaus.s
 Share

Recommended Posts

Hello,

this script may replace the normal desktop quick launch button on the xp task bar and provides an additional double click function, i.e. open/close of desktop explorer view. Probably there is a lot to improve, suggestions welcome.

; ----------------------------------------------------------------------------

;

; AutoIt Version: 3.1.0

; Author: klaus.s 20051014

;

; Script Function:

; double-click desktop

;

; ----------------------------------------------------------------------------

#Include <process.au3>

Opt("WinTitleMatchMode", 3)

$p= "..."

If WinExists( $p) Then

$t= WinGetText($p)

WinKill( $p)

If StringLeft($t,1) = "c" Then

WinClose( "Desktop")

Exit

Endif

_RunDOS( "start ""Desktop"" """ & @DesktopDir & """")

Exit

EndIf

If WinGetState( "Desktop") = 7 Then

ProgressOn( $p, "close desktop with double-click")

Else

ProgressOn( $p, "open desktop with double-click")

Endif

Sleep( 300)

if Not WinExists( $p) Then Exit

ProgressOff()

WinMinimizeAll()

; ----------------------------------------------------------------------------

-- Klaus

Link to comment
Share on other sites

I'm confused. Maybe the version I have of autoit doesn't support this, but when I run it, it starts a progress bar and then it minimizes all the windows and brings up the desktop and then autoit is gone. This is fairly complicated, especially for someone new, but is this what's supposed to happen when I run it?

Edit: Oh yea, when you post code, there's a little button to press for it. If you look at the bar there is a # sign. Click that before and after you post code. Oh yea I have a little collection of scripts if you want to look at them for ideas.

Edited by Mr.Llama
Link to comment
Share on other sites

I'm confused. Maybe the version I have of autoit doesn't support this, but when I run it, it starts a progress bar and then it minimizes all the windows and brings up the desktop and then autoit is gone.

....

here a step-by-step instruction:

- right click on your quick-launch area, e.g. between start button and first quick launch button and select 'open folder' from the context-menu (to get this context-menu is sometimes tricky)

- in this folder (...\Microsoft\Internet Explorer\Quick Launch) create and edit a new autoit script and name it dd.au3 (the name actually does not matter)

- copy/paste the posted code into this file and exit/save

- probably move the new button by drag and drop to a more convenient place within the quick launch bar

functions:

- one click: minimize all to make the Desktop *area* visible

- double click: popup the Desktop *folder* if yet not visible, otherwise close it.

have fun

-- Klaus

Link to comment
Share on other sites

Attached the zipped exe file of an improved version, ready to replace the xp desktop icon. Hint: you may move the present dektop file one folder level higher to save space in the quick launch bar. This way any change is reversibel.

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:        klaus.s  20051014
;
; Script Function:
;   double-click desktop
;
; ----------------------------------------------------------------------------
Opt("TrayIconHide", 1)
Opt("WinWaitDelay", 10)
$p= "double-click desktop"
$p1= $p & "1"
$p2= $p & "2"

If WinExists( $p2) Then Exit

If WinExists( $p1) Then
  AutoItWinSetTitle( $p2)
  WinWaitClose( $p1, "", 5)
  $s= WinGetState( "Desktop")
  
  If BitAND( $s, 16) Then; is minimized
    WinSetState( "Desktop", "", @SW_RESTORE)
    Exit
  Endif
  
  If BitAND( $s, 2) Then; is visible
    WinClose( "Desktop")
    Exit
  Endif
  
  Run( @ComSpec & " /c start ""Desktop"" """ & @DesktopDir & """", "", @SW_HIDE)
  Exit
  
EndIf

AutoItWinSetTitle( $p1)

$a= WinList()
$n= 0
For $i= 1 To $a[0][0]
  $s= $a[$i][0]
  If $s = "Program Manager" Then ContinueLoop
  If $s = "" Then ContinueLoop
  $s= WinGetState( $a[$i][1])
  If BitAND( $s, 16) Then ContinueLoop; is minimized
  If BitAND( $s, 2) Then $n= $n +1; is visible
Next

If $n Then WinMinimizeAll()

Sleep( 300)

If WinExists( $p2) Then
  If $n Then WinMinimizeAllUndo()
Else
  If Not $n Then WinMinimizeAllUndo()
Endif

; ----------------------------------------------------------------------------

-- Klaus

Edit: # = Code ;)

ddesktop.zip

Edited by klaus.s
Link to comment
Share on other sites

  • 2 weeks later...

Update: no more double-click with the new odesktop, but essentially the same function with a smarter logic.

Quick guide for odesktop
========================

Right click on the Quick Launch bar, after the last button in the
taskbar, to have the context menu with 'open folder' and select this
to open "...\Microsoft\Internet Explorer\Quick Launch"

Move the file "Open Desktop.scf" to a save place; I think just one
level higher should be Ok. This way any change to your Quick Launch
bar can be restored whenever necessary.

Unzip odesktop and place the odesktop directory to a useful location, for
example to have it as %programfiles%\odesktop.

Within odesktop, double click create_shortcut.js to create
"click above inner icon to open folder.lnk".

Drag and drop this shortcut directly to a convenient position within
the Quick Launch bar.

Now you should have replaced the original function of the desktop icon
by odesktop and everything is prepared to try:

Click on the icon but not higher than the inner icon
--> ToggleDesktop function as usual

Click on the icon above the inner icon
--> Open Desktop as folder


klaus.s 2005`10`25

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:        klaus.s  20051025
;
; Script Function:
;   option/open desktop
;
; ----------------------------------------------------------------------------
#NoTrayIcon
Opt( "WinWaitDelay", 10)
AutoItSetOption ( "MouseCoordMode", 2)

; ----------------------------------------------------------------------------
Func OpenDesktop()
  Local $h, $MyComputer  
  
  If WinExists( "Desktop") Then
    WinActivate( "Desktop")
    
  Else
    $MyComputer= "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
    $h= WinGetHandle( "")
    Run( @WindowsDir & '\explorer.exe "' & $MyComputer & '"')
    WinWaitNotActive( $h)
    Sleep( 10)
    Send( "{BS}"); one level up == Desktop
  Endif
  
EndFunc  

Func ToggleDesktop()
  Send( "#d")
EndFunc  

; ----------------------------------------------------------------------------
$a= MouseGetPos()

If $a[1] < 10 Then
  OpenDesktop()

Else
  ToggleDesktop()

Endif
; ----------------------------------------------------------------------------

You will find all relevant files in the attached zip-file.

-- Klaus

odesktop.zip

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...