Comparison:
Question(s):
Can we have the standalone list file parameter ('%WL') and the modified list file parameter ('%WL %Y') behaviour consistent regarding point 2?
I.e., when there's no selection and the cursor is on a file/folder, the item under the cursor is sent to the list file.
If not, then can we have a separate modifier for '%WL' that would keep points 1,3 useful behavior as of '%WL %Y' and obtain point 2 useful behavior as from standalone '%WL'?
What exactly is being caught there from the TC in case 1 [in place of %WL or rather by itself?
As I can see, it is assumed to be just the current active pane path.]* It can easily be seen as such and would work like a charm most of the time (for regular situations).
However, if the active path happens to exceed the 260-symbol limitation, only the drive letter is passed/accepted, and the logic to further work with files and folders (as in the example script below) would completely fail.
Can the TC handle the super-long paths here?
* Note: I'm not sure what the correct wording for that to be there, sorry.
Tools for testing, if needed:
PowerShell script (echoParamsFiles.ps1):user-commands (usercmd.ini):user-buttons:
# | %WL standalone | %WL with modifier | |
% | modifier | not applicable | %Y |
mode | behavior | behavior | |
1 | no selection, cursor on [..] | nothing = useless: no valid %WL parameter, no list file, no other valid parameters are passed as well | fully useful: %WL parameter is valid, list file is empty, other parameters: OK (e.g., %P, %T, etc, are passed) |
2 | no selection, cursor on a file/folder | fully useful: item under cursor is passed to %WL, list file is a list, other parameters: OK | effectively useless: item under cursor is NOT passed to %WL, list file is empty, other parameters: OK |
3 | active selection, there are files/folders selected | fully useful: all selected items are passed to %WL, list file is a list, other parameters: OK | fully useful: all selected items are passed to %WL, list file is a list, other parameters: OK |
Question(s):
Can we have the standalone list file parameter ('%WL') and the modified list file parameter ('%WL %Y') behaviour consistent regarding point 2?
I.e., when there's no selection and the cursor is on a file/folder, the item under the cursor is sent to the list file.
If not, then can we have a separate modifier for '%WL' that would keep points 1,3 useful behavior as of '%WL %Y' and obtain point 2 useful behavior as from standalone '%WL'?
What exactly is being caught there from the TC in case 1 [in place of %WL or rather by itself?
As I can see, it is assumed to be just the current active pane path.]* It can easily be seen as such and would work like a charm most of the time (for regular situations).
However, if the active path happens to exceed the 260-symbol limitation, only the drive letter is passed/accepted, and the logic to further work with files and folders (as in the example script below) would completely fail.
Can the TC handle the super-long paths here?
* Note: I'm not sure what the correct wording for that to be there, sorry.
Tools for testing, if needed:
PowerShell script (echoParamsFiles.ps1):
Code:
$time = [diagnostics.stopwatch]::StartNew()$files = $folders = @()if ($pwd){'try current path as $pwd'|Write-Host -f DarkCyan$pwd|Write-Host -f Cyan$path = [string]$pwd;$length=$path.length+1}''if (-not($args)){$message = 'working folder ($pwd)''no parameters; try files from current path'|Write-Host -f DarkCyan$files = Get-ChildItem $path -file -recurse -force$folders = Get-ChildItem $path -directory -recurse -force}if ($args){$message = '%WL list file''list file as %WL'|Write-Host -f DarkCyan$list = [IO.FileInfo]$args[0];$list.Name|Write-Host -f Cyan'''source path as %P'|Write-Host -f DarkCyan$source = [IO.DirectoryInfo]$args[1];$source.Name|Write-Host -f Cyan$path = [string]$source;$length=$path.length'''target path as %T'|Write-Host -f DarkCyan$target = [IO.DirectoryInfo]$args[2];$target.Name|Write-Host -f Cyan'''read %WL list file ({0})' -f $list.Name|Write-Host -f Greenif ($list.length -le 2){'list file is empty'|Write-Host -f Yellow} else {$lines = [IO.File]::ReadLines($list)foreach ($line in $lines){if ((Get-Item $line) -is [IO.FileInfo]){$file = [IO.FileInfo]$line;$files += $file}if ((Get-Item $line) -is [IO.DirectoryInfo]){$folder = [IO.DirectoryInfo]$line;$folders += $folder}}}}''# do something with files and folders'{0} files in {1}' -f $files.count,$message|Write-Host -f DarkCyanforeach ($file in $files){# do something with files (here, display relative paths)$file.FullName.substring($length)|Write-Host -f Cyan}'''{0} folders in {1}' -f $folders.count,$message|Write-Host -f DarkCyanforeach ($folder in $folders){# do something with folders (here, display relative paths)$folder.FullName.substring($length)|Write-Host -f Cyan}''$time.Stop()'{0} files and {1} folders found for {2:mm}:{2:ss}.{2:fff}' -f $files.count,$folders.count,$time.Elapsed|Write-Host -f DarkCyansleep -seconds 12
Code:
[em_test_tc_params_files]cmd=pwsh -c "%commander_path%\Plugins\apps\PowerShell\echoParamsFiles.ps1"param=%WL '%P' '%T' %Q %Y[em_test_tc_params_files_standalone]cmd=pwsh -c "%commander_path%\Plugins\apps\PowerShell\echoParamsFiles.ps1"param=%WL '%P' '%T' %Q
Code:
TOTALCMD#BAR#DATAem_test_tc_params_fileswcmicon2.dll0-1
Code:
TOTALCMD#BAR#DATAem_test_tc_params_files_standalonewcmicons.dll0-1
Statistics: Posted by beb — 2025-04-24, 08:59 UTC