Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Emulate "Show Desktop" shortcut with keyboard macro

If you have a question or need help, this is the place to be.
Post Reply
loomy
Posts: 42
Joined: Sat Sep 22, 2007 10:07 pm

Emulate "Show Desktop" shortcut with keyboard macro

Post by loomy »

So I tried to figure this out, but no luck.

I want to have a shortcut (that runs with eventghost.exe -e {command} as per http://www.eventghost.org/wiki/Command-line_reference ) that acts like the "Show Desktop" shortcut.

The difference being that it uses the Win+M and Win+Shift+M keyboard command emulation. The advantage with these is that they will only minimize what is on the primary monitor, whereas (in a multimonitor situation) "Show Desktop" will minimize everything on all monitors.

I either can't figure out how to make the macro, or I can't figure out how to make the command line -e work, or both :)

Any advices out there?

PS: Why does the Eventghost tray icon turn red? Why is it mad at me :(

Thanks :oops:
loomy
Posts: 42
Joined: Sat Sep 22, 2007 10:07 pm

Re: Emulate "Show Desktop" shortcut with keyboard macro

Post by loomy »

I figured it out, but I'll mention the problems I had.

Firstly I expected the yellow events to be executable (green arrow) if they are indeed the things that macros are triggered with.

Secondly I thought -e {blah} meant that the {}s needed to be around the blah :( This complicated the fact that I couldn't figure out how to get -e to execute events because I didn't know that "Main." had to be before them. If the events were manually executable or had a properties page with their unique name, I would have figured it out right away. Instead it took time and forum reading to realize that you have to backwards engineer the names of these things: first you run the -e blah, and then you look in eventghost to see what the blah showed up as (Main.blah for instance), then you rename your events to be called Main.blah.

Now on to the good part!!

Code: Select all

<Folder Name="minimize all maximize all primary monitor toggle" Expanded="True">

	<Macro Name="minimize" id="223" Expanded="True">
<Event Name="Main.min-max"/>
<Action>Window.SendKeys(u'{Win+M}', False)</Action>
<Action>EventGhost.EnableExclusive(XmlIdLink(227))</Action>
</Macro>

	<Macro Name="maximize" id="227" Enabled="False" Expanded="True">
<Event Name="Main.min-max"/>
<Action>Window.SendKeys(u'{Win+Shift+M}', False)</Action>
<Action>EventGhost.EnableExclusive(XmlIdLink(223))</Action>
</Macro>
</Folder>
I wish it executed a bit faster (there is some latency before the command executes, while Show Desktop is faster and the manual key input is instant), but I am still pleased! Thanks EventGhost! :wink:
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Emulate "Show Desktop" shortcut with keyboard macro

Post by Bitmonster »

Actually you don't need to name any event items. Instead simply drag them from the log to the macro you want.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
loomy
Posts: 42
Joined: Sat Sep 22, 2007 10:07 pm

Re: Emulate "Show Desktop" shortcut with keyboard macro

Post by loomy »

Bitmonster wrote:Actually you don't need to name any event items. Instead simply drag them from the log to the macro you want.
My point was that it is unintuitive because it is backwards -- after you create a macro you have to go use the macro (that which activates it) before you can finish the macro :)
Post Reply