Who doesn’t love WinRAR, where time stops and 40 days trial can never expires? There are not nagging screens or anything obtrusive, it just works! :)

Yeah, it says “trial” in the about dialog, but what so? Probably, if you installed it on your workplace, you need to have licensed software or to stop using WinRAR after the 40-day trial, even thought the application doesn’t enforce this in any way. This is not a legal advice, so read the license agreement and act accordingly. ;)

Now, let’s talk about 7-Zip, it’s great piece of software, small, fast, clean interface, if you haven’t given it a try - you should. You can specifiy a temp directory, I remember numerous times I couldn’t open an archive, because I didn’t have enough space on the C: drive back in the day, now the hard disk space is not that big of a problem, unless you own a small SSD disk, of course.

We (developers) consider ourselves power-users, probably everyone has different opinion on what this means, but what I can for myself - I like to use keyboard shortcuts. I like to use the same keyboard shortcut to do the same thing in different applications! What a surprise, right? I am sure you don’t want to memorize 10 different shortcuts for copy operation in every application you use, e.g. Chrome, Word, Notepad, etc (you get the point), you just hit Ctrl + C and move on.

That is the case with 7-Zip, I miss a shortcut, more specifically - a shortcut to close 7-Zip itself. That’s actually good news, not the missing shortcut, but that I want to do something really simple - to just close the app. If I wanted to do something more complex, probably I wouldn’t be able to do it, or at least not that easily.

A great piece of software for automating, binding shortcuts and other automating tasks is AutoHotkey, if you have never heard of it - just take a quick glance of its home page. Although it is scripting language, some very interesting and useful projects were built with it, check the forums, there you can get help from the community, which is pretty responsive too!

Without further ado, let’s go to the code. I will comment it inline, so you can get a better understanding, it’s really simple script - 3 LoC (lines of code).

Just give me code:

; Check if the current window has the "FM" title
; (use the Au3_Spy.exe bundled with AutoHotkey to check it for yourself)
#IfWinActive ahk_class FM
; Register the Ctrl + W shortcut to close the window with "FM" title
    ^w::WinClose ahk_class FM
; We want nothing more, so just return
Return

Now, that’s everything the script has to it. Just a little clarification, why we first check for the window and then register the hotkey - AutoHotkey supports the so-called context-sensitive hotkeys. If you reverse the order and first register the hotkey, it will surely work for 7-Zip, but will stop working for all other applications as you are not explicitly handling it yourself!

That’s it for now, next time I will write on some other little thing I miss in 7-Zip.