Keyboard Ninja: Assign a Hotkey to any Window Tangentbord Ninja: Tilldela en lösningen till alla fönster
When I need to perform a repetitive task such as checking my email or switching to an open IM window, the quickest option is to assign a hotkey directly to the window, so I can toggle the window minimized/restored with nothing more than a single keystroke. När jag behöver för att utföra en återkommande uppgift såsom kontroll min e-post eller byta till ett öppet IM fönster, det snabbaste alternativet är att tilldela en lösningen direkt på fönstret, så jag kan växla fönstret minimerat / återställas med bara en enda knapptryckning .
How did I accomplish this? Hur fick jag genomföra detta? AutoHotkey AutoHotkey , a small scripting framework that allows you to automate anything in Windows. En liten scripting ramverk som låter dig automatisera någonting i Windows. Before we begin, I'm going to assume that you've downloaded and installed it. Innan vi börjar, kommer jag att anta att du har hämtat och installerat den.
I've created a small function that you can add to a script which will do the hard work of finding and toggling the window. Jag har skapat en liten funktion som du kan lägga till ett skript som gör det hårda arbetet med att hitta och ändra fönstret. All you have to do is assign the hotkeys you want at the top of the script. Allt du behöver göra är att tilldela snabbtangenter du vill ha på toppen av skriptet. 
The first thing you will need to do is Det första du behöver göra är download the script ladda script and save it somewhere useful. och spara den någonstans användbar. You should be able to simply double-click on the script to start it, and then you will notice a new tray icon (The green one with the H) Du bör kunna dubbelklicka på skript för att starta det, och då kommer du märka en ny ikonen (den gröna med H)

Right-click on the icon, and choose Edit This Script from the menu. Högerklicka på ikonen och välj Redigera Detta Script från menyn. You'll have to add in your own hotkeys since none are defined in the script, so let's go take a look at the script… Måste du lägga in din egen hotkeys eftersom ingen definieras i manuset, så låt oss gå ta en titt på skript ...
; —————————————————————– ; ----------------------
; Declare Your hotkeys in this section ; Deklarerar hotkeys i detta avsnitt
; —————————————————————– ; ----------------------
; —- these are samples —- - Dessa prover --
; !j::ToggleWindow(”- Mozilla Firefox”) – Win + J ;! J:: ToggleWindow ( "- Mozilla Firefox") - Win + J
; #c::ToggleWindow(”SecureCRT”) – Win + C , # C:: ToggleWindow ( "SecureCRT") - Win + C
; !x::ToggleWindow(”cmd.exe”) – Alt + X ;! X:: ToggleWindow ( "cmd.exe") - Alt + X; —————————————————————– ; ----------------------
; Function for toggling windows - Do not edit ; Funktion för pendelfunktion fönster - Don't redigera
; —————————————————————– ; ----------------------
ToggleWindow(TheWindowTitle) ToggleWindow (TheWindowTitle)
{ (
SetTitleMatchMode,2 SetTitleMatchMode, 2
DetectHiddenWindows, Off DetectHiddenWindows, Off
IfWinActive, %TheWindowTitle% IfWinActive,% TheWindowTitle%
{ (
WinMinimize, %TheWindowTitle% WinMinimize,% TheWindowTitle%
} )
Else Annan
{ (
IfWinExist, %TheWindowTitle% IfWinExist,% TheWindowTitle%
WinActivate WinActivate
Else Annan
{ (
DetectHiddenWindows, On DetectHiddenWindows, On
IfWinExist, %TheWindowTitle% IfWinExist,% TheWindowTitle%
{ (
WinShow WinShow
WinActivate WinActivate
} )
} )
} )
} )
It might be a little complicated for some of you, but the only thing we need to do is add in some hotkey lines. Det kan vara lite besvärligt för en del av er, men det enda vi behöver göra är att lägga i några hotkey rader. You'll notice that there are a number of sample hotkey lines defined already, but commented out. Du kommer att märka att det finns ett antal linjer prov hotkey definierade redan, men kommenterade ut.
Hotkeys are defined in this format: Snabbtangenter definieras i detta format:
<keys>::ToggleWindow(”Partial Window Title String”) <keys>: ToggleWindow ( "Partial Window Titel String")
For special keys, you'll use one of the following, which can be combined. För speciella tangenter kan du använda någon av följande, som kan kombineras. (get more information at (Läs mer på Autohotkey AutoHotkey documentation) dokumentation)
| # # | Windows key Windows-tangenten |
| ! ! | Alt Alt |
| ^ ^ | Control Control |
| + + | Shift Växla |
| < < | Use Left key (for instance <! means left Alt key only) Använd Vänster knapp (till exempel <! Betyder vänster Alt-tangenten only) |
| > > | Use Right key (for instance >! means right Alt key only) Använd högra knappen (till exempel>! Betyder höger Alt-tangenten only) |
So for instance, if you wanted to trigger the keyboard shortcut of Ctrl+Alt+F and assign it to Firefox, you would use the following: Så till exempel, om du ville utlösa snabbtangenten av Ctrl + Alt + F och koppla den till Firefox, skulle du använda följande:
^!f::ToggleWindow(”- Mozilla Firefox”) ^! f:: ToggleWindow ( "- Mozilla Firefox")
Personally, I try to use keyboard shortcuts that don't require me to lift my hands off the keys. Personligen försöker jag använda kortkommandon som inte kräver mig att lyfta mina händer bort nycklarna. I simply use Alt+J assigned to Firefox because I can hit that combination without moving my hands at all. Jag använder bara Alt + J hänföras till Firefox eftersom jag kan slå den kombinationen utan att röra mina händer alls.
When you are done editing the script, just save it and then go up to the H icon again, and choose the “Reload This Script” option, which will load all of your changes. När du är klar med redigeringen av scripts, bara spara den och sedan gå upp till H-ikonen igen och välj "Reload detta skript" alternativet, som kommer att läsa alla dina ändringar. If there was a problem, you'll get an error message, and you can always use Exit to stop the script entirely. Om det fanns ett problem, får du ett felmeddelande, och du kan alltid använda Avsluta för att stoppa script helt.

You'll have to decide which key combinations work best for you. Du måste bestämma vilken tangentbordskombinationer fungerar bäst för dig. My advice is to add one or two at a time, and get used to using them. Mitt råd är att lägga till en eller två åt gången, och vänja sig vid att använda dem. Within a few days you'll wonder how you ever lived without them. Inom några dagar kommer du att undra hur du någonsin levt utan dem. You should also read up on AutoHotkey as well… it can do much more than just this. Du bör även läsa upp AutoHotkey liksom ... man kan göra mycket mer än bara detta.
Note: The function ToggleWindowHide function in the script is for the more adventurous – it will toggle the window between hidden and restored… extremely useful for command prompt windows. Obs: Funktionen ToggleWindowHide funktionen i skriptet för de mer äventyrliga - Det kommer att växla fönster mellan svart och återställd ... oerhört användbar kommandotolk fönster. Essentially gives me Tilda or YaKuake on Windows. Huvudsak ger mig Tilda eller yakuake på Windows.
Download geek_autohotkey.ahk (Autohotkey script) Download geek_autohotkey.ahk (AutoHotkey script)

Daily Email Updates Dagligt Updates
You can get our how-to articles in your inbox each day for free. Du kan få våra instruktioner artiklar i din inkorg varje dag gratis. Just enter your name and email below: Skriv bara in ditt namn och e-postadress nedan:



Thanks for this, its an awesome utility! Tack för detta, its an awesome utility!
If you don't mind I'll write some of my scripts: Om du inte har något emot Jag ska skriva några av mina scripts:
#IfWinActive ahk_class CabinetWClass # IfWinActive ahk_class CabinetWClass
MButton::Send {backspace} MButton:: Skicka (backspace)
This one checks if the active window is an explorer window and assigns middle click to have the same function as backspace, going to the parent folder, pretty useful for all-mouse browsing. This one kontrollerar om det aktiva fönstret är en utforskare fönster och tilldelar Middle Click ha samma funktion som backsteg, går till den överordnade mappen, ganska bra för alla-mus surfar.
I also have some programing functions (for PHP and Flash), for example: Jag har också en del programmering funktioner (för PHP och Flash), till exempel:
::_if:: :: _if::
Send if () {{}{}}{Left 4} Skicka if () {{}{}}{ Left 4)
return return
If I type “_if” the program will replace that by “if () {}” and will place the typing cursor between the “()” (moving the cursor 4 times to the left) , allowing me to continue coding right away. Om jag skriver "_if" Programmet kommer att ersätta det med "if () ()" och kommer att placera skriva markören mellan "()" (flytta markören 4 gånger till vänster) genom att låta mig fortsätta kodning direkt. I also use this for my mail (using Jag också använda detta för min mail (med _@). _ @).
Again, thank you for showing me this little beauty Återigen, tack för att du visar mig denna lilla skönhet
The first sample in the screenshot ( ! j ) …. Det första provet på skärmbilden (! J) .... that should be Alt + J som bör Alt + J