AHK script as Total Commander button

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Scr1pter
Posts: 1277
Joined: 06 Aug 2017, 08:21
Location: Germany

AHK script as Total Commander button

Post by Scr1pter » 30 Apr 2024, 16:19

Hello,

I put an AHK script inside of the Total Commander (TC) button bar.
Additionally, I added the path to the AHK compiler, so it looks like this (simplified):
"C:\AutoHotkeyU64.exe" C:\myscript.ahk

This is the AHK example script:

Code: Select all

for n, param in A_Args  ; For each parameter:
{
    MsgBox Parameter number %n% is %param%.
}
The problem:
When I drag multiple files inside of this button, it only shows the first file.

I also tried different things like putting extra parameters inside of the TC button:
"C:\AutoHotkeyU64.exe" C:\myscript.ahk %P\%N

My wish is that I perform some action for multiple files at once.
Right now, it would only work for 1 file...

Thanks for any help and best regards
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09

User avatar
mikeyww
Posts: 27165
Joined: 09 Sep 2014, 18:38

Re: AHK script as Total Commander button

Post by mikeyww » 30 Apr 2024, 16:40

I tried adding a new command to the TC Start Menu. It worked.

TOTALCMD64.EXE240430-1738-001_cr.png
TC Start Menu
TOTALCMD64.EXE240430-1738-001_cr.png (13.36 KiB) Viewed 371 times

User avatar
Scr1pter
Posts: 1277
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: AHK script as Total Commander button

Post by Scr1pter » 06 May 2024, 03:53

Hi and thanks for your answer.

After multiple tries it finally worked.
Either when the ahk script is in command or parameter.
Also with %P%S, but even without this parameter.

The import thing is that you don't drag the files into the button but just mark them and click the button.
That's really confusing in my opinion.

Also, by default there is always at least one marked/selected item in TC, so AHK would always show this one as parameter.

But looks it's not an AHK related problem anymore...

Cheers!
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09

Post Reply

Return to “Ask for Help (v1)”