How do I create a keyboard shortcut for "Show/Hide all windows"?

4

1

I have software that does the command, I want to somehow bind it to a keyboard key:

Take it as a general question given a tray icon right clicking it and going through submenus, i'd like to speed up the process and make a shortcut to this option.

and it is possible in theory. if something could for example record what setting the option changes.. and assign a keyboard shortcut to it.

alt text

barlop

Posted 2010-12-17T15:07:35.940

Reputation: 18 677

What app is providing that menu? – Doug Harris – 2010-12-17T18:27:29.607

What's wrong with Alt+Tab or (if the OS is new enough) "Windows key" + tab? Please give us more information like Doug Harris is talking about. – David – 2010-12-17T18:40:45.633

@Doug Harris Rainlendar. Can autohotkeys not do it? There is no minimize button, it uses one of those special skins.. and doesn't appear in alt-tab menu. there are probably quite a few apps like it. If there was a way to go through the menu as mentioned with a shortcut, that'd be a solution regardless of app. but if you know of another solution, that's not quite as good but if it works and there's no better one then fine. I don't mind you stating it in comment before knowing what app it is, since it may be of use to know. – barlop – 2010-12-18T02:16:21.680

@David it's not even in Alt+Tab see comment above to Doug. – barlop – 2010-12-18T02:16:53.223

Answers

3

AutoHotkey has PostMessage and SendMessage commands that can send internal "messages" to windows or controls. Often programs use these types of messages for their menu commands. To find out the proper message values you need, you use a program like Winspector to log messages of possible interest.

For more information, see SendMessage Tutorial.

(This tutorial is also buried in the AutoHotkey help file: go to the bottom of the PostMessage/SendMessage page, and in the Related links, click on Message Tutorial.)


The program pictured in Barlop's question is Rainlendar.

Using the methods from the tutorial above, I made the following example AutoHotkey script that sets F11 to "Hide all windows" and F12 to "Show all windows".

WM_COMMAND := 0x111
SHOW_ALL := 598
HIDE_ALL := 599

DetectHiddenWindows, On

#IfWinExist Rainlendar2 Control Window ahk_class wxWindowClassNR

F11::
  window_id := WinExist("Rainlendar2 Control Window ahk_class wxWindowClassNR")
  PostMessage, %WM_COMMAND%,%HIDE_ALL%,,,ahk_id %window_id%
Return

F12::
  window_id := WinExist("Rainlendar2 Control Window ahk_class wxWindowClassNR")
  PostMessage, %WM_COMMAND%,%SHOW_ALL%,,,ahk_id %window_id%
Return

Bavi_H

Posted 2010-12-17T15:07:35.940

Reputation: 6 137

1(D'oh. Rainlendar has its own hotkey settings: OptionsHotkeys) – Bavi_H – 2010-12-18T05:39:06.417

thanks, i'm using the hotkeys within rainlendar now but it'd be good to have the autohotkeys script working with rainlendar too. i'm not that familiar with autohotkeys , but I just saved that code as .ahk and double clicked it, it looks like it's loaded in autohotkeys. I am trying F11 and F12 but nothing happens. – barlop – 2010-12-18T15:27:09.380

I just downloaded Rainlendar yesterday to play around with it. Perhaps the window name or command numbers are different in your version. You can try downloading the latest version of Rainlendar, or try using Winspector to find the values your version uses. – Bavi_H – 2010-12-19T00:05:50.183

just tried your script on another computer and it worked first time.. tried it again on the funny one and it worked straight away.. so I guess I just copy/pasted wrong.. Great stuff. – barlop – 2010-12-19T07:09:09.440

@Bavi_H By the way, out of interest, does that work by sending a message to the tray icon? or to the window that appears on the desktop? Is it to your knowledge possible to send it to the tray icon? – barlop – 2010-12-19T07:11:17.800

In Windows programming, the term "window" includes lots more things than the windows you see on the desktop: individual buttons, text fields, and even hidden "windows" can all recieve these kinds of "messages". Here is the window list shown in Winspector when Rainlendar is running. In this case, I just found an invisible window owned by the Rainlendar process that was getting WM_COMMAND messages when I clicked on the menu items. I made the AutoHotkey script send the same messages to the same window.

– Bavi_H – 2010-12-19T08:09:20.613

0

Windows 7 / Make shortcut:

Target Location: %windir%

Target: %windir%\explorer.exe shell:::{3080F90D-D7AD-11D9-BD98-0000947B0257}

Start in: %windir%

Then define shortcut key.

Windows XP (unverified):

If the show desktop option in quick launch both shows and hides the desktop (i don't remember) you can do the same thing with a shortcut for it.

Though i used to use other third party software to do this at XP (it also had configurable hotkeys) http://dm2.sourceforge.net/

helena4

Posted 2010-12-17T15:07:35.940

Reputation: 308