21 June 2005

Windows console a la Quake

Image hosted by Photobucket.com

I read a comment on Slashdot yesterday and was intrigued by it. A poster (admittedly off-topic) was lamenting the lack of a really cool and functional drop-down console for Windows, similar to the tilde-enabled console for Quake. I too thought this was a really cool idea, I decided to investigate it myself. I was unable to find any software product currently out there (free or otherwise) that offered a Quake-style console for use in a normal Windows environment. I was, however, able to find a program (called Console, simply enough) that offered a transparent command-line window for Windows, with other options for behavior, but no built-in hotkeys.

So, I was getting all set to modify the open-source Console to do what we all really want out of our console, when I came across a message from the author of the program talking about why he didn't implement hotkeys. He said that he used a program called PowerPro, and that handled all of his hotkey (and other) automation needs.

So I investigated that, combined with Console. After a little bit of hacking, I have what I believe is a pretty versatile script for sliding down a console window. I'm putting the instructions here, since this is the place for randomness.

Prerequisites:
  1. Get Console - http://sourceforge.net/projects/console
    Install to C:\Program Files\Console
  2. Get PowerPro - http://www.ppro.org
    Install to the default
Now you're going to have to edit some text files. First, the PowerPro script. Copy the following (in between the BEGIN and END) into a new notepad file, and save it as C:\Program Files\PowerPro\scripts\ShowConsole.powerpro

Edit: Updated the script to reflect problems with my earlier copy/paste work. :-[

Edit 2 (2005-07-30): Again, updated to reflect problems with copy/paste... Is Blogspot truncating my code?
-------BEGIN--------

;; Set animate to 0 to turn off animation, otherwise set to animation speed (lower = faster)

animate = 5
consoleexe = "C:\Program Files\Console\console.exe"
consolewindow = "c=*Console Main Command Window*"


;; END USER-EDITABLE PARAMETERS


If (activewindow(consolewindow) and visiblewindow(consolewindow)) do
Jump SlideOut
ElseIf (visiblewindow(consolewindow))
Window.show(consolewindow)
ElseIf (anywindow(consolewindow)) do
Jump SlideIn
Else
do(consoleexe)
wait.until(anywindow(consolewindow))
EndIf

Quit



@SlideIn
If (animate) do
Window.show(consolewindow)
h = eval(window("height", consolewindow))

newy = 0 - h
incy = h / animate
int = -255 / animate

Window.Position("=", newy, "=", "=", consolewindow)

for (; newy < 0; newy = newy + incy)
Window.Position("=", newy, "=", "=", consolewindow)
endfor

Window.Position("=", 0, "=", "=", consolewindow)
Else
Window.show(consolewindow)
EndIf

Quit


@SlideOut
If (animate) do
h = eval(window("height", consolewindow))

newy = 0
incy = h / animate
targety = 0 - h

for (; newy > targety; newy = newy - incy)
Window.Position("=", newy, "=", "=", consolewindow)
endfor

offscreeny = 0 - yscreen

Window.Position("=", offscreeny, "=", "=", consolewindow)

Window.hide(consolewindow)
Else
Window.hide(consolewindow)
EndIf

Quit

--------END---------

Next, you need to run PowerPro. The first time you run, it takes you through a configuration wizard, and things might appear very daunting - the program is VERY powerful. I recommend stepping through it to at least get a little bit of familiarity with the setup of things. When you're done with the wizard, you're going to want to go into the "Configure" dialog, and the "Key/Mouse" tab.

Create a new Key/Mouse action. In the "Enter command" dropdown list, choose *Script, then select "RunFile" from the "Script action" dropdown. Select your ShowConsole.powerpro file. Now, if you click on the "Type key" textbox at the top of the window, you can map any key to showing the console (including just a plain old tilde without any extra modifiers!). Hit OK when you've mapped a key, apply the settings, and close the Configure dialog.

Now you should be able to open a console window by hitting the key you mapped. Hit the key a few times, to check that it's hiding and reappearing. Feel free to experiment with the value of the animation variable by editing the script in notepad and saving it. You'll see the changes immediately after you save and hit your hotkey.

I didn't find the default settings of the console window quite to my liking. The main things I changed were the transparency/alpha settings and the starting position of the window. You can right-click on the console window, then choose "Edit configuration" to bring up an XML config file. Make changes, save it, then right-click on the window and "Reload settings."

Feel free to move the console window around. When it comes back down, it will be at the same horizontal position of where you moved it to (but it will be at the top of your monitor). If you want the console to be the width of your monitor, edit the console configuration.

I'm still thinking about maybe modifying the program itself... in the meantime, though, I hope people find this useful/cool. Feel free to leave a comment if you have any questions about it. I'm also interested if you have any suggestions about other places to put this type of thing on the 'net.