AHK scripts and empty %L 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:

AHK scripts and empty %L parameter

Post by *LonerD »

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?
"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
Stefan2
Power Member
Power Member
Posts: 4133
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: AHK scripts and empty %L parameter

Post by *Stefan2 »

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: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: AHK scripts and empty %L parameter

Post by *petermad »

Try using %Y"%L" in stead of "%L"
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Stefan2
Power Member
Power Member
Posts: 4133
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: AHK scripts and empty %L parameter

Post by *Stefan2 »

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: 381
Joined: 2010-06-19, 20:18 UTC
Location: Makeyevka, Russia
Contact:

Re: AHK scripts and empty %L parameter

Post by *LonerD »

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
"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