Sign in to follow this  
Followers 0
Angel

Google Desktop Toggle

2 posts in this topic

Hi,

I have Google Desktop installed and although I was using its "Sidebar" mode I finally got tired of it. However the other modes that are offered do not work for me. The "Deskback" mode takes too much space from my already crowded windows taskbar, while the "Floating Deskbar" is always there on top and it becomes annoying after a while.

So I made this little script that let's me show or hide the floating bar with the click of a button (F8 in my case) and also when clicking on the tray icon.

Note that BEFORE RUNNING THIS SCRIPT you MUST set the Google Desktop mode to "Floating Deskbar" by clicking in the little triangle button that shows you the Google Desktop menu.

Also note that this script requires the beta version of AutoIt.

Here is the code:

#include <Constants.au3>

; Make sure that there is only one copy of the program running
; To do so, use the "AutoIt Window Title":

; Set a temporary Title to distinguish the new copy from the one that might already be running
AutoItWinSetTitle ( "NewGoogleDesktopToggle" )
If WinExists("GoogleDesktopToggle") Then
    WinClose("GoogleDesktopToggle")
;MsgBox(0,"Debug","Warning","A previous copy was already running!")
    Sleep(1000); Wait for the "old" copy of the program to Exit...
; And then start the new one!
EndIf
AutoItWinSetTitle ( "GoogleDesktopToggle" ); Set the final title that this copy is already running

;Opt("TrayMenuMode",1)  ; Default tray menu items (Script Paused/Exit) will not be shown.
Opt("WinTitleMatchMode",4); Use "classname" to match windows as well
Opt("TrayOnEventMode",1); Enable Tray Events

HotkeySet("{F8}","GoogleDesktopToggle"); Show The Google Desktop window when clicking F*...
TraySetOnEvent ( $TRAY_EVENT_PRIMARYUP, "GoogleDesktopToggle" ); ... and when clicking on the tray icon

TraySetClick ( 8 ); Show the regular AutoIt tray meny when right clicking on the tray icon
TraySetToolTip("Google Desktop")

; We need a loop to keep the HotKey alive!
While 1
    Sleep(10000)
WEnd


;- Function that shows/hides the Google Desktop floatie
Func GoogleDesktopToggle()
  $s_google_class = "classname=ATL:004595F0"; Define the Google Desktop window classname
    
  If WinExists($s_google_class,"") == 0 Then
    ; Do nothing if Google Deskptop is not running!
        $s_google_class = "classname=Shell_TrayWnd"
    ;If WinExists($s_google_class,"") == 0 Then
        ;MsgBox(0,"Debug","Error","GD not found!")
            Return
    ;EndIf
  EndIf
  
  If BitAND(2,WinGetState($s_google_class)) Then
    ; If it is visible, hide it
        ControlSend($s_google_class,"","_GD_QueryEditBox1","{Esc}")
    WinSetState($s_google_class,"",@SW_HIDE)
  Else
    WinSetState($s_google_class,"",@SW_SHOW)
        WinActivate($s_google_class,"")
        Sleep(100)
    ControlClick($s_google_class,"","_GD_QueryEditBox1")
  EndIf
EndFunc

In my case, I also extracted the GoogleDesktop Icon from the GoogleDesktop.exe (using the free Icon editor Icon Sushi, which can be found here) and I used it to compile the script.

I hope someone finds this useful.

Of course this could be enhancing by adding a menu to select the key that can be used to show/hide GoogleDesktop. I leave that as an exersize ;-)

Cheers!

Angel

Share this post


Link to post
Share on other sites



Hello Angel

This thread is 7 years old and I'm not even sure if you're even still alive but i'm so pissed of and desparate I am gonna try anyway.

I have actually been running myself ragged trying to find a solution to this fly on my desktop (O bane of my existence) and even tried editing the 'resource.dll' file.
I can't for some reason get this script to work.
I coppied the code to a txt file, downloaded the Autoit-v3.3.9-18-beta setup, clicked 'run script' (x64) (Beta) and selected the txt file. Could I have missed soomething?
Alternatively, I would also like to know which file might I edit (maybe the resource.dll?) and where can I edit it so I may get rid of this damned floating deskbar or at least make it so that it isn't always on top
Thanks in advance :)

Share this post


Link to post
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
Sign in to follow this  
Followers 0