Page 1 of 2
Access to a column values ?
Posted: 2007-05-01, 00:08 UTC
by byblo
Is it possible to access to a column values, to calculate the total and showing it somewhere?
As example, a wdx plugin is called to give some value (as instance, time of a mp3) Could TC once all values done, give to the concerned plugin a pointer to the column table, and after calculation, receive the result to show somewhere.
As instance :
track01.mp3 | 1:20
track02.mp3 | 2:45
-----------------------
2 files | 4:05
I'm astonished that it is not included in tc yet

Posted: 2007-05-01, 09:55 UTC
by m^2
It's not easy with current wdx plugin interface. What calculations can you do with strings of characters?
Posted: 2007-05-01, 18:59 UTC
by guent peer
It should be possible if not easy to rechange the type from a string into a number.

Posted: 2007-05-02, 00:39 UTC
by byblo
Indeed. The string type isn't a problem at all. (it is almost easier...)
Posted: 2007-05-02, 05:27 UTC
by m^2
guent peer wrote:It should be possible if not easy to rechange the type from a string into a number.

But you suggest addition of time. What number? There are many possible interpretations.
-decimal
-hexadecimal (usually starts with 0x, so not a big problem)
-hexagesimal
-binary
-others (like distance, here simple addition just doesn't work)
Now imagine that you have units as suffixes...
Posted: 2007-05-02, 06:56 UTC
by Lefteous
2byblo
Displaying such information in the statusbar of TC could be very useful. Configurable status bar information has been discussed during the TC 6.5 and 7 alpha test but wasn't implemented obviously.
It's implemented in Directory Opus since some versions and I somewhere read it will be added to SpeedCommander 12 if that means anything to you.
Posted: 2007-05-07, 07:20 UTC
by byblo
@M^2 :
The plugin is supposed to know which type of values he have to totalize, how he is the source of them into the concerned column...
But also, there are others ways, like just letting TC calculate the total, and giving to him a simple "mask" filter, like in this example :
(lets suppose we have time to calculate)
3:20
2:10
-----
total ?
On this example, the TC's user can enter a mask (which by the way, mean that the user can do it by itself for ALL existing content plugin, and didn't need an update from the author), like [mm]:[nn]#[mm]:[nn] (time#result format)
Now, TC know the way on how to calculate it, so, here the returned result will be obviously 5:30
It will permit also custom result, like [mm]:??#[mm], which will make TC only calculate minutes, ignoring seconds (when represented by ??, or whatever...). It is a very simple example, but playing around and making it even a bit more complicated, the possibilities will be infinites.
@Lefteous:
I'm thinking to eventually move to another file manager, but I don't want to start a polemic here, so I'll do not give my reasons... Thanks for the suggestions, I'll take a look.
Posted: 2007-05-07, 08:29 UTC
by m^2
byblo wrote:@M^2 :
The plugin is supposed to know which type of values he have to totalize, how he is the source of them into the concerned column...
Yes, definitely. But ( currently ? ) there's no way to tell TC how things should be added.
byblo wrote:But also, there are others ways, like just letting TC calculate the total, and giving to him a simple "mask" filter, like in this example :
(lets suppose we have time to calculate)
3:20
2:10
-----
total ?
On this example, the TC's user can enter a mask (which by the way, mean that the user can do it by itself for ALL existing content plugin, and didn't need an update from the author), like [mm]:[nn]#[mm]:[nn] (time#result format)
Now, TC know the way on how to calculate it, so, here the returned result will be obviously 5:30
It will permit also custom result, like [mm]

?#[mm], which will make TC only calculate minutes, ignoring seconds (when represented by ??, or whatever...). It is a very simple example, but playing around and making it even a bit more complicated, the possibilities will be infinites.
This solution requires user's attention, but is probably better than nothing.
Posted: 2009-11-20, 06:08 UTC
by byblo
After more than 2 years I still strongly needing such feature for TC. Hopeless ?
Posted: 2009-11-21, 14:26 UTC
by MVV
You may select files and copy all columns into Excel or OpenOffice Calc where you may calculate needed values.
Posted: 2009-11-23, 01:40 UTC
by byblo
MVV wrote:You may select files and copy all columns into Excel or OpenOffice Calc where you may calculate needed values.
Thank you for the trick, but the goal here is to have the function directly integrated to TC. But it seems i am the only one who needs it. Nevermind...
Posted: 2009-11-23, 04:07 UTC
by MVV
byblo wrote:... the goal here is to have the function directly integrated to TC. But it seems i am the only one who needs it. Nevermind...
Maybe you're not the only one, but such things requires a lot of work to support all standard types of fields and operations for them (e.g. numbers, time etc).
Posted: 2009-11-23, 04:18 UTC
by byblo
MVV wrote:byblo wrote:... the goal here is to have the function directly integrated to TC. But it seems i am the only one who needs it. Nevermind...
Maybe you're not the only one, but such things requires a lot of work to support all standard types of fields and operations for them (e.g. numbers, time etc).
Please read the whole topic before posting

Posted: 2009-11-23, 10:24 UTC
by Balderstrom
Here's an AHK "solution"
I don't seem to be able to modify TC's StatusBar or the Path String (to the left of the Command-Line), thus cannot do exactly as the original suggestion.
This could also be made to be auto-updating if needed (?)
I tend to prefer a calling via a HotKey or a Button on the Toolbar.
The output could be displayed in a Persistent or Temporary Tooltip or even in TC's TitleBar. Currently it displays (dumps the output) into the command-line.
The line
timeColumn = 2, would need to be updated to the appropriate Column that contains length/time data. My test Custom Column has the Length field as the 2nd column (after the filename/ext). Thus if it is not the 2nd column, then update that line accordingly.
The AHK script accepts time input as #h #m #s, OR #m #s, OR #:#:#, OR #:#
I didn't bother with plain-jane just a number field (i.e. seconds only)
Code: Select all
timeColumn = 2
outputMaxTime := "Mins"
;; outputMaxTime := "Hours"
IfWinNotActive, ahk_class TTOTAL_CMD
return
WinGet, aApp
PostMessage, 0x433, 2036, ,, A
fileList := Clipboard
hour := 0
mins := 0
secs := 0
ControlGetFocus, aControl, A
SetControlDelay, 0
Loop, Parse, fileList, `n
{
i := 1
tmpLine := A_LoopField
Loop, Parse, tmpLine, %A_Tab%
{
if( A_Index == timeColumn )
{
if( !RegExMatch( A_LoopField, "^()()(\d+)(m |:)(\d+)s?", tmpLine ))
RegExMatch( A_LoopField, "^(\d+)(h |:)(\d+)(m |:)(\d+)s?", tmpLine )
hour += tmpLine1 ? tmpLine1 : 0
mins += tmpLine3
secs += tmpLine5
}
}
}
mins += Floor( secs / 60 )
secs := Mod( secs, 60 )
if( secs < 10 )
secs = 0%secs%
if( outputMaxTime == "Hours" )
{
hour += Floor( mins / 60 )
mins := Mod( mins, 60 )
if( mins < 10 )
mins = 0%mins%
}
outputString := hour . ":" . mins . ":" secs
if( !RegExMatch( outputString, "^0:(\d+:\d+)", outputString ))
outputString1 := outputString
TCStatus := (aControl == "TMyListBox1") ? "TMyPanel8": "TMyPanel5"
ControlGetText, statusText, %TCStatus%, ahk_id %aApp%
;;
;; BUG: unable to change TC's StatusBar...
;;
;ControlSetText, %TCStatus%,FOOBAR , ahk_id %aApp% ;; "(%outputString1%) %statusText%", A
;MsgBox, (%outputString1%) %statusText%
ClipBoard = %statusText% --> TotalTime Selected: (%outputString1%)
PostMessage, 0x433, 4003 ;; Focus on Command-Line
Send, ^v ;; Paste Clipboard to Command-Line
return
A customizable Status-Bar would be pretty cool, Too bad.
Too difficult to do a time-counter? I think not, MVV.
Posted: 2009-11-23, 11:55 UTC
by Balderstrom
Here's an Auto-Updating TimeSelected version.
I went with a "fall-through" trigger on Left (or Right) click
instead of a persistent Timer that checks for StatusBar changes.
While testing I found a bad quirk/bug: When there is any text present in the command line you cannot use the Space bar to select files, the Command-Line steals its focus every time.
I'd recommend setting up a HotKey to turn on/off the TimeCounter, or a HotKey to launch/initialize the script when needed and exit from it afterwards.i.e.
Code: Select all
TCTimeCounter := 0
;;
;; Hotkey: Win+t
;;
#t::Toggle(TCTimeCounter, "TCTimeCounter")
Toggle(byRef onOff, displayVar="")
{
onOff := ( onOff == 0 ) ? 1 : 0
if( displayVar <> "" )
MsgBox, ,, %displayVar%: %onOff%, 1
return onOff
}
Code: Select all
;;
;; TCMP3LStatus.ahk
;;
TCStatusText := "EMPTY"
#ifWinActive ahk_class TTOTAL_CMD
{
~*LButton::
{
KeyWait LButton
if( TCTimeCounter )
TCUpdateTimeCounter()
return
}
;; Uncomment this block if you use RB Mouse Mode
/*
~RButton::
{
KeyWait, RButton
if( TCTimeCounter )
TCUpdateTimeCounter()
return
}
*/
;; If you want the Counter to update when selecting files with INSert
;; Uncomment the following block.
/*
~INS::
{
if( TCTimeCounter )
TCUpdateTimeCounter()
return
}
*/
return
}
TCUpdateTimeCounter()
{
global TCStatusText
timeColumn = 2
outputMaxTime := "Mins"
;; outputMaxTime := "Hours"
IfWinNotActive, ahk_class TTOTAL_CMD
return
WinGet, aApp
ControlGetFocus, aControl, A
if(!RegExMatch( aControl, "TMyListBox(1|2)") )
return
TCStatus := (aControl == "TMyListBox1") ? "TMyPanel8": "TMyPanel5"
ControlGetText, statusText, %TCStatus%, ahk_id %aApp%
if( statusText == TCStatusText ) ;; Check if StatusBar has changed since last 'click'
return
TCStatusText := statusText
hour := 0
mins := 0
secs := 0
if( !RegExMatch( statusText, "in (0) / \d+ files", tmpText ) )
{
PostMessage, 0x433, 2036, ,, A ;; Copy FileNames + Details (columns) to Clipboard
fileList := Clipboard
Loop, Parse, fileList, `n
{
i := 1
tmpLine := A_LoopField
Loop, Parse, tmpLine, %A_Tab%
{
if( A_Index == timeColumn )
{
if( !RegExMatch( A_LoopField, "^()()(\d+)(m |:)(\d+)s?", tmpLine ))
RegExMatch( A_LoopField, "^(\d+)(h |:)(\d+)(m |:)(\d+)s?", tmpLine )
hour += tmpLine1 ? tmpLine1 : 0
mins += tmpLine3
secs += tmpLine5
}
}
}
}
mins += Floor( secs / 60 )
secs := Mod( secs, 60 )
if( secs < 10 )
secs = 0%secs%
if( outputMaxTime == "Hours" )
{
hour += Floor( mins / 60 )
mins := Mod( mins, 60 )
}
outputString := hour . ":" . mins . ":" secs
if( !RegExMatch( outputString, "^0:(\d+:\d+)", outputString ))
outputString1 := outputString
;;
;; BUG: unable to change TC's StatusBar...
;;
;ControlSetText, TMyPanel3,FOOBAR , ahk_id %aApp% ;; "(%outputString1%) %statusText%", A
;MsgBox, (%outputString1%) %statusText%
ClipBoard = %statusText% --> TotalTime Selected: (%outputString1%)
PostMessage, 0x433, 4003 ;; Focus on Command-Line
Send, ^v ;; Paste Clipboard to Command-Line
return
}