3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

"Drop Down", Quake-style command prompt for Windows

Step 3Configure your Hotkey Mapper, part 2.

Configure your Hotkey Mapper, part 2.
After our little tryst with Window Spy, we now have the information we need to complete our script, right?

Let's try again:

#`::IfWinExist ahk_class Console Main Command Window{	IfWinActive ahk_class Console Main Command Window	  {			WinHide ahk_class Console Main Command Window		}	else	  {	    WinShow ahk_class Console Main Command Window	  }}else	Run [[shortcut to console]]return

Okay; that should work, right?

Not quite. It's good, but it's not right. Yet. We have a couple of issues outstanding.

When you run the script, and press your hotkey, you'll notice that Console launches. Another press - it disappears. Great!

Not really. Press it again - and it launches another session of Console! That's not right, is it?

Issue 1: Hidden Consoles stay hidden
So, we're losing the script at "IfWinActive" - it can't find the hidden Console!

AHK has a command for that - DetectHiddenWindows. Let's add it now.

#`::DetectHiddenWindows, onIfWinExist ahk_class Console Main Command Window{	IfWinActive ahk_class Console Main Command Window	  {			WinHide ahk_class Console Main Command Window		}	else	  {	    WinShow ahk_class Console Main Command Window	  }}else	Run consoleDetectHiddenWindows, offreturn

Run it again. This time, it'll hide - but, hmm... it won't come back!

Issue 2: Hidden Consoles really stay hidden
What's happening here is, the console is hidden by WinHide, but it's still active. We need to move the focus somewhere else, so that the IsWinActive call won't return true. The easiest place to send that focus is to the Windows Taskbar.

#`::DetectHiddenWindows, onIfWinExist ahk_class Console Main Command Window{	IfWinActive ahk_class Console Main Command Window	  {			WinHide ahk_class Console Main Command Window			WinActivate ahk_class Shell_TrayWnd		}	else	  {	    WinShow ahk_class Console Main Command Window	  }}else	Run consoleDetectHiddenWindows, offreturn

Close, but no cigar! It comes back, but it's not active - you can't just start typing!

Issue 3: Home movie effect - Console hasn't got focus!
Easy. We'll just make sure that when we show it, we give it focus straight away.

#`::DetectHiddenWindows, onIfWinExist ahk_class Console Main Command Window{	IfWinActive ahk_class Console Main Command Window	  {			WinHide ahk_class Console Main Command Window			WinActivate ahk_class Shell_TrayWnd		}	else	  {	    WinShow ahk_class Console Main Command Window	    WinActivate ahk_class Console Main Command Window	  }}else	Run consoleDetectHiddenWindows, offreturn

It works! Except... we can't close it with escape. That's the icing on the cake.

Issue 4: No way out!
This is just a matter of adding a quick second script to the end of your .AHK file:

#IfWinActive ahk_class Console Main Command Windowesc:: {   WinHide ahk_class Console Main Command Window   WinActivate ahk_class Shell_TrayWnd }return

Simply: if we're in Console, escape hides it. Done!

So - that's it for the AHK file. But your console window is still appearing in the middle of the screen - not very Quake-like. Let's fix that.
« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
1
Followers
1
Author:paraxion