FAQs: automate/script TC with AutoHotkey AHK

English support forum

Moderators: sheep, Hacker, Stefan2, white

Post Reply
User avatar
Power Member
Power Member
Posts: 2779
Joined: 2007-09-13, 22:20 UTC
Location: Europa

FAQs: automate/script TC with AutoHotkey AHK

Post by *Stefan2 »

AutoHotkey and Total Commander

Also see our wiki and search for "autohotkey"

- - - English

AutoHotkey is a small, portable freeware tool to automate many things in WindowsTM.
For example: Click a Button, manipulate text, access clipboard, read or write files.
See "AutoHotkey – Wikipedia" > https://en.wikipedia.org/wiki/AutoHotkey

We use often AutoHotkey to "extend" Total Commander.
Download the file "AutoHotkey.zip" from https://autohotkey.com/download/
Please also note the Documentation > https://autohotkey.com/docs/AutoHotkey.htm
Beginner Tutorial AutoHotkey v2 by tidbit > https://lexikos.github.io/v2/docs/Tutorial.htm
Beginner Tutorial AutoHotkey by tidbit > https://autohotkey.com/docs/Tutorial.htm

- - -

Unpack die ZIP-Archive to a folder called "AHK" inside of your Total Commander folder.
If in forum is mentioned a "AutoHotkey.exe" which you don't find, then just use "AutoHotkeyU32.exe" instead.

For scripts is could be important to utilize die right Exe-Version (1.0.x -or- 1.1.x)
There is a older AutoHotkey version, Version 1.0, "classic" or "basic" (the last was from 2013)
And there is a newer one with version always start with 1.1.x, like "AutoHotkey_1.1.30.00.zip"

If you are provided with a script to solve your problem, use it this way:
- Create a new text file in folder "Total Commander\AHK\new.ahk" (or even use ".txt" extension)
- Copy and paste the script into this "new.ahk" file and save it.
-----Example script: MsgBox HEY, that really works! ;-)

- Execute that script (as temporary solution, as an test):
--- Change to "Total Commander\AHK\" folder
------ Either:
Drag&Drop the AutoHotkey.exe on the Button bar. Drag now the file "new.ahk" on the new created button.
------ Or :
Type 'AutoHotkey new.ahk' in TC-command line (or launch a black CMD / DOS window)
(Please note that the Smiley is not displayed, because the semi-colon is the line comment sign of AHK)

To create a button for that script, which can work on any place, not only in the AHK-folder, we need to use full paths to Exe and script.
Because we use a sub folder of the TC-folder, we can utilize the "%Commander_Path%" environment variable to point to the TC-folder:
Command: "%Commander_Path%\AHK\AutoHotkey.exe" "%Commander_Path%\AHK\neue.ahk"
Parameters: << leave empty, or as advised in forum >>
Start path: << leave empty, or as advised in forum >>
Icon file : "%Commander_Path%\AHK\AutoHotkey.exe" <or WCMICONS.DLL>
Tooltip : What does this button|Line break|Another new line

- - - Deutsch

AutoHotkey ist ein kleines, portables Freeware Tool, um viele Dinge in WindowsTM zu automatisieren.
Zum Beispiel: Klicke einen Button, manipuliere Text, greife auf die Zwischenablage zu, lese oder schreibe Dateien.
Siehe "AutoHotkey – Wikipedia" > https://de.wikipedia.org/wiki/AutoHotkey

Wir benutzen oftmals AutoHotkey um den Total Commander zu "erweitern".
Lade dir die Datei "AutoHotkey.zip" von https://autohotkey.com/download/ herunter.
Beachte auch die Documentation > https://autohotkey.com/docs/AutoHotkey.htm
AutoHotkey Anfänger-Tutorial von tidbit > https://ahkde.github.io/docs/Tutorial.htm
Kurze Einführung in Autohotkey (mit Beispielen) > https://office-tipps.net/kleine-einfuehrung-in-autohotkey-mit-beispielen/

Entpacke das ZIP-Archiv in einen Ordner Namnes "AHK" in deinen Total Commander-Ordner.
Wenn im Forum auf "AutoHotkey.exe" verwiesen wird und du diese nicht findest, dann verwende einfach die Datei "AutoHotkeyU32.exe".

Bei Skripten kann es wichtig sein, die korrekte Exe-Version (1.0.x -oder- 1.1.x) zu verwenden.
Von AutoHotkey gibt es eine ältere "classic" oder "basic" versions als Version 1.0 (die Letzte war von 2013)
Das neuere AutoHotkey hat immer eine Version 1.1.x, wie zB "AutoHotkey_1.1.30.00.zip"

Wenn dir ein AHK-Skript zur lösung deines Problems angeboten wird, verwende es folgendermaßen:
- Erstelle eine neue Textdatei im Ordner "Total Commander\AHK\neue.ahk" (oder verwende .txt, also "neue.txt")
- Kopiere das Skript in die Datei "neue.ahk" und speichere diese.
-----Beispielsskript: MsgBox HEY, das klappt ja! ;-)

- Führe das Skript aus (als vorläufige Lösung, als Test):
--- Wechsel in den Ordner "Total Commander\AHK\"
----- Entweder:
Drag&Drop die AutoHotkey.exe auf die Buttonbar. Ziehe dann die Datei "neue.ahk" auf den eben erstellten Button.
----- Oder:
Tippe 'AutoHotkey neue.ahk' in die TC-Kommandozeile ein (oder öffne ein schwarzes CMD / DOS Fenster)
(Beachte das das Smiley nicht angezeigt wird, weil das Semikolon das "Kommentarzeichen" bei AHK ist)

Um mit dem Skript einen Button zu erstellen, welcher überall funktionieren soll,
und nicht nur im aktuellen AHK-Ordner, benötigen wir die kompletten Pfade zur Exe und zum Skript.
Da wir einen Unterordner des TC-Ordner verwenden, können wir die Umgebungsvariable "%Commander_Path%" verwenden:
Kommando: "%Commander_Path%\AHK\AutoHotkey.exe" "%Commander_Path%\AHK\neue.ahk"
Parameter: << leer lassen, oder wie im Forum angegeben >>
Icondatei: "%Commander_Path%\AHK\AutoHotkey.exe" <oder WCMICONS.DLL>
Tooltip : Was macht dieser Button|hier Zeilenumbruch|erneuter Umbruch

- - - the files / die Dateien

AutoHotkey_1.1.30.00.zip (22-Aug-2018)
AutoHotkeyA32.exe ANSI, 32-bit, also for 64-bit OS (800byte)
AutoHotkeyU64.exe Unicode, 64-bit, for 64-bit OS only and not really needed (for us). (1200b)
AutoHotkeyU32.exe Unicode, 32-bit, also for 64-bit OS (900b)

AutoHotkey104805_v1.0.48.05.zip (30-Sep-2013)
AutoHotkey.exe (250byte)
AutoHotkey Website.url


User avatar
Power Member
Power Member
Posts: 638
Joined: 2014-01-06, 16:26 UTC
Location: MOW

Re: FAQs: automate/script TC with AutoHotkey AHK

Post by *Ovg »

Hi Stefan2!
The latest version is v1.1.30.01 - November 11, 2018 (From https://www.autohotkey.com/download/)
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 9.51 x64, Windows 7 SP1 x64

User avatar
Site Admin
Site Admin
Posts: 39405
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland

Re: FAQs: automate/script TC with AutoHotkey AHK

Post by *ghisler(Author) »

I welcome these FAQ threads. However, I would appreciate if you could also update the Wiki pages directly. You can log in to the Wiki with your forum user name and password! Thanks.
Author of Total Commander

Post Reply