AHK scripts and empty %L parameter

English support forum

Moderators: white, sheep, Hacker, Stefan2

Post Reply
User avatar
LonerD
Senior Member
Senior Member
Posts: 292
Joined: 2010-06-19, 20:18 UTC
Location: Donetsk

AHK scripts and empty %L parameter

Post by *LonerD » 2018-09-22, 15:54 UTC

Simple AHK script:

Code: Select all

msgbox, %1%
msgbox, %2%
msgbox, %0%
Parameters:

Code: Select all

"%L" 1
or

Code: Select all

1 "%L"
Put cursor on parent dir [..] position (%L is empty).
In both cases script shows empty results, 0 parameters :|
Can't even read first non-empty (="1") value.

Tried "if 0 < 2" (check if single parameter), manipulations with quotes... - nothing.

How can script get non-empty parameter if %L is empty?
Total Commander DreamLair - dream always, think totally, be the commander of you own life.

User avatar
Stefan2
Power Member
Power Member
Posts: 2170
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: AHK scripts and empty %L parameter

Post by *Stefan2 » 2018-09-22, 16:35 UTC

It seems TC sends no param at all if %L or %F functions are not called since there was no selection at all.
The other params are just dropped then @ghisler(Author)?



A quick test with a MS-DOS Batch shows the same behaviour:

@ECHO OFF
ECHO.
ECHO P1 %1
ECHO.
ECHO P2 %2
ECHO.
PAUSE


Button with Param: TEST "%L"
Execute one time on a file or with a selection, another time on '..' entry at top of file list (== empty selection).
P1 shows the value 'TEST' only, if P2 has a value too to show.


BTW, the '..' line can be disabled, IIRC, if that helps.

 

User avatar
petermad
Power Member
Power Member
Posts: 8055
Joined: 2003-02-05, 20:24 UTC
Location: Valsted, Denmark
Contact:

Re: AHK scripts and empty %L parameter

Post by *petermad » 2018-09-23, 00:39 UTC

Try using %Y"%L" in stead of "%L"
License #524
Danish Total Commander Translator
TC 9.21a 32+64bit on Win XP 32bit, Win 7, 8.1 & 10 64bit and TC 2.92b1 on Android 6.0
Get: Extended Total Commander Menus | PHSM-Calendar

User avatar
Stefan2
Power Member
Power Member
Posts: 2170
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: AHK scripts and empty %L parameter

Post by *Stefan2 » 2018-09-23, 09:02 UTC

petermad wrote:
2018-09-23, 00:39 UTC
Try using %Y"%L" in stead of "%L"
That did the trick, thank you.

Help wrote:
%Y anywhere in the parameters:
Pass empty list to program when using one of the List parameters like %L. Otherwise, the file under the cursor would be passed.




I remember I read that once too, but didn't could imagine when to use that.



  

User avatar
LonerD
Senior Member
Senior Member
Posts: 292
Joined: 2010-06-19, 20:18 UTC
Location: Donetsk

Re: AHK scripts and empty %L parameter

Post by *LonerD » 2018-09-23, 17:06 UTC

petermad wrote:
2018-09-23, 00:39 UTC
Try using %Y"%L" in stead of "%L"
Thank you.
I didn't carefully check new features.
Very useful :D
Total Commander DreamLair - dream always, think totally, be the commander of you own life.

Post Reply