Autohotkey + Total commander parameter

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
LonerD
Senior Member
Senior Member
Posts: 381
Joined: 2010-06-19, 20:18 UTC
Location: Makeyevka, Russia
Contact:

Autohotkey + Total commander parameter

Post by *LonerD »

I create simple script Script.ahk:

Code: Select all

#NoEnv
#NoTrayIcon
Path = %1%
Msgbox, % Path
ExitApp
Button or em-command:

Code: Select all

%commander_path%\AutoHotkey\AutoHotkey.exe "%commander_path%\Scripts\Script.ahk"
Parameter - %P (path to current directory).

But if path contains space - script can't receives this parameter correctly (it receives only part of path before space).
If I try use "%P" in quotes - then script adds excess quotes to path...

How to correct?
"I used to feel guilty in Cambridge that I spent all day playing games, while I was supposed to be doing mathematics. Then, when I discovered surreal numbers, I realized that playing games IS math." John Horton Conway
User avatar
Hacker
Moderator
Moderator
Posts: 13064
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

LonerD,
Try

Code: Select all

"%P\"
HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
LonerD
Senior Member
Senior Member
Posts: 381
Joined: 2010-06-19, 20:18 UTC
Location: Makeyevka, Russia
Contact:

Post by *LonerD »

Hacker wrote: Try

Code: Select all

"%P"
Thank you, but it not work with search result in panel and in archives.
With this parameter in search result msgbox shows one quote ", but we must get empty result.
"I used to feel guilty in Cambridge that I spent all day playing games, while I was supposed to be doing mathematics. Then, when I discovered surreal numbers, I realized that playing games IS math." John Horton Conway
User avatar
nsp
Power Member
Power Member
Posts: 1804
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

LonerD wrote:
Hacker wrote: Try

Code: Select all

"%P"
Thank you, but it not work with search result in panel and in archives.
With this parameter in search result msgbox shows one quote ", but we must get empty result.
This is a completely different topic !
It is a known limitation, TC parameters are not supported inside archive unless you use a%Z at least once. The starting folder will be defaulted to the archive location.
%Z %P will be the source inside the archive i.e: C:\ZIP FOLDER\File.zip\FOLD_INSIDE\
You have an interesting windows that descibe all of this if you click on help !
User avatar
LonerD
Senior Member
Senior Member
Posts: 381
Joined: 2010-06-19, 20:18 UTC
Location: Makeyevka, Russia
Contact:

Post by *LonerD »

nsp wrote:you use a %Z at least once
Of course, I use %Z for archives.
If I use parameter "%P" %Z - script returns correct results for archives, but incorrect for directories (for example - it returns E:\MyDir" instead E:\MyDir\, it returns " in search results instead empty value ).
If I use "%P" %Z - script returns correct results for directories, but not for archives (for example - it returns C:\MyArch.rar" ).

In VB scripts it's no problems with TC parameters.
But I can't understand - how it works in Autohotkey.

How can I get source path via TC parameter in Autohotkey script?
"I used to feel guilty in Cambridge that I spent all day playing games, while I was supposed to be doing mathematics. Then, when I discovered surreal numbers, I realized that playing games IS math." John Horton Conway
User avatar
LonerD
Senior Member
Senior Member
Posts: 381
Joined: 2010-06-19, 20:18 UTC
Location: Makeyevka, Russia
Contact:

Post by *LonerD »

I found one solution is add to script additional string

Code: Select all

#NoEnv
#NoTrayIcon
Path = %1%
StringReplace, Path, Path, ", \, All
Msgbox, % Path
ExitApp
and use parameter "%P\" (or %Z"%P\" ).
"I used to feel guilty in Cambridge that I spent all day playing games, while I was supposed to be doing mathematics. Then, when I discovered surreal numbers, I realized that playing games IS math." John Horton Conway
Post Reply