Parametrized command COPYSTR

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Parametrized command COPYSTR

Post by *MVV »

Yesterday Balderstrom and I discovered that currently TC has no way to export useful information like content plugin data etc. So, I suggest to make a new command like COPYSTR with parameter that may contain traditional %P, %S or %L parameters but also support plugins.

I.e., I want to copy reparse point target path, which may be returned by [=ntlinks.Obj_Type] string, so I create a button with command COPYSTR "%P points to [=ntlinks.Obj_Type]".

Also I suggest to add some command for copying such data for all selected files/folders, so if I execute command like COPYSTRALL "%P%N\t[=tc.file type]\t[=ntlinks.Obj_Type]", I'll get in clipboard such info for each selected file/folder.

Currently TC supports generating such strings for parameters strings, custom columns etc. So there should be some generic function that will write into some buffer such strings. And we need only to add a command for copying this string into clipboard. :)
Last edited by MVV on 2009-08-30, 06:50 UTC, edited 1 time in total.
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

Support++ (Of course) :twisted:
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

@ MVV : I'd recommend changing the COPYSTR in the Thread Title to something like: WDXCOPY

Also I don't think it really needs parameterized support, defaulting to whatever the cursor is on and/or whatever files are selected in the active panel would more than suffice, no?

I have found a really inconvenient workaround with TCMC.exe,
Sending 4 commands:
%Commander_Path%\Tools\TCMC.exe 50 CMcm_SrcLong CMcm_SrcNextCustomView CMcm_CopyFileDetailsToClip CMcm_SrcLong
That fetches far too much info: The full details of the current Custom Column (which was changed just prior to copy to clip) -- so it would need to be post-processed via a script|filter. Then yer at 2 separate buttons and a batch script to process the clipboard contents ... just to get a piece of info from the CustomColumn :P
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I don't think adding parameters support is hard and maybe someone will need some fields that available only through %-params.
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

I've found WdxInfoPacker, but the amount of time I've wasted trying to get it configured is crazy. Plus it appears to be buggy and doesn't like Wdx's that use underscores (And possibly "#" - but not sure if that one is still an issue). I can't get it to return anything but "1" for any of the ntlinks fields.
Plus if you try and use it on a Folder, instead of giving you info on the Folder, it tries to pack the folder.

The best bet I have right now, is prolly going to be an AHK script:
* change TC to CustomColumn #1,
* do a cm_CopyFileDetailsToClip,
* regex filter based on the embedded \t (tabs) to grab the field I want.
* copy result back to ClipBoard
* change the CustomColumn back to Details.

This request is unlikely, due to the fact you can copy file details, which includes CustomColumns - so long as you are currently using that custom column. And also due to the fact that "WdxInfoPacker" exists. Except its a serious pain to configure and if you can actually get it to work, it's extreme overkill when all you want is to fetch a couple (or even one) Wdx field.

WdxInfoPacker tries to do way too many things in a cramped interface, Data Collection, Text Formatting, Filtering, Text Replacement, etc. and finally text output to a file. Apparently there is also a CopyInfo2Clip.exe included with it, but you need to create a valid scheme.ini first. And I'm tired of trying to make it do something basic.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

currently TC has no way to export useful information like content plugin data
Actually there is a way: Switch to a custom columns view of your choice, select some files, and choose Mark - Copy names with all details.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

ghisler(Author) wrote:
currently TC has no way to export useful information like content plugin data
Actually there is a way: Switch to a custom columns view of your choice, select some files, and choose Mark - Copy names with all details.
Yes, this thing I'd missed. But this way is not very comfortable, especially if you need one field of one file.
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

Yeah, WdxInfoPacker does a bunch of "StringReplace(filename,'_', ' '" of underscores in the source (I don't know why).

Also, the CopyInfo2Clip.exe source has some very strange lines:
myIni4Copy:=TIniFile.Create(ExtractFilePath(path)+'CopyInfo2Clip.ini');
path2give:=myIni4Copy.ReadString('Main','pathSend2Wdx','c:\totalcmd\contplug.ini');
myiniPath:=myIni4Copy.ReadString('Main','WdxInfoPacker.ini','c:\totalcmd\WdxInfoPacker.ini');
dll2load:=myIni4Copy.ReadString('Main','WdxInfoPacker.wcx',ExtractFilePath(path)+'WdxInfoPacker.wcx');
Course, I haven't coded in Pascal since 1993 so I'm more than rusty.
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

@ MVV, I have a solution, but its a script... so you prolly wont like it ;-)

AHK Script, Activated by WIN+O (easy to change)
Requires you have a Custom Column named RP_Target (easy to change)
that contains as its first column: [=ntlinks.RP_Target]

Code: Select all

CheckTCRedirect( iniSection )
{
	wincmd = %COMMANDER_INI%
	iniRead, iniRedirect, %wincmd%, %iniSection%, RedirectSection, %wincmd%
	SplitPath, iniRedirect, iniFile, iniPath
	if( !iniPath )
		SplitPath, wincmd, tmpFile, iniPath
	return iniPath . "\" . iniFile 
}

iniReadTC( iniSection, iniKey )
{
	iniFile := CheckTCRedirect( iniSection )
	IniRead, keyValue, %iniFile%, %iniSection%, %iniKey%, %A_Space%
	return keyValue
}

#o::
{
	ifWinActive, ahk_class TTOTAL_CMD
	{
		customColumnNames := iniReadTC( "CustomFields", "Titles" )
		if( InStr(customColumnNames, "RP_Target") )
		{
			StringSplit, ccArray, customColumnNames, |
			Loop, %ccArray0%
			{
				if( ccArray%A_Index% == "RP_Target" )
				{
					dx := A_Index
					break
				}

			}
		}
		else
		{
			MsgBox, Requires a Custom Column named: RP_Target,`nThat has: [=ntlinks.RP_Target] as the first column
			return
		}

		WinGet, aApp
		MouseGetPos, ,,,aControl
		lParam := 0x1587		; Right Panel
		if( aControl == "TMyListBox2" )
			lParam := 0x1586	; Left Panel
		SendMessage, 0x433, %lParam%, %dx%,,ahk_id %aApp%
		SendMessage, 0x433, 0x7F4	; cm_CopyFileDetailsToClip
		SendMessage, 0x433, 0x12E ; cm_SrcLong (Details)
		StringSplit, rpTarget, Clipboard, %A_Tab%
		Clipboard := rpTarget2
		ClipWait, 1
		MsgBox, %Clipboard%
	}
}
return
It's pretty specific atm, but easy enough to break it into a function that can query for any CustomColumn.
Post Reply