feature request: sequence detection

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
ragornette
Junior Member
Junior Member
Posts: 12
Joined: 2003-06-04, 14:21 UTC

feature request: sequence detection

Post by *ragornette »

hello
would it be possible to have a sequence detection, I usually work with tons of images and I'd like to see this kind of options like seeing
my sequence detected as that:
myimage_0001.tga ==> myimage_####.tga
myimage_0002.tga
myimage_0003.tga
myimage_0004.tga
myimage_0005.tga
myimage_0006.tga

then by clicking on it, be able to see the complete sequence.
And even be able to see if I have some missing frames.
Could it be interesting for other users?

Long time ago, a nice software was doing this kind of stuff, called sequence master from spankola. But I think they're dead now.
Don't know if it's a big deal to do and if it's useful for the others.

Thanks
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3301
Joined: 2003-05-06, 11:46 UTC

Post by *Sir_SiLvA »

how about the thumbview? :)
Hoecker sie sind raus!
ragornette
Junior Member
Junior Member
Posts: 12
Joined: 2003-06-04, 14:21 UTC

Post by *ragornette »

but thumview doesn't collapse sequence.
I just want to be able to copy, move sequence (and do more things) like if it was a single file not tons of file.
User avatar
wanderer
Power Member
Power Member
Posts: 1578
Joined: 2003-03-28, 14:35 UTC
Location: Sol

Post by *wanderer »

Sometimes i found myself searching for such a feature. Something like ALT + Num+, but not to select files by extension but by name, like ragornette described. It would be very useful. I think it was requested sometime ago (perhaps by me, i don't remember at all) ...
- Wanderer -

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3
x64: Clients/Servers from Win7 to Win11 and Win2K12Srv to Win2K22Srv, mainly Win10 though.
User avatar
ado
Senior Member
Senior Member
Posts: 445
Joined: 2003-02-18, 13:22 UTC
Location: Slovakia, Pezinok

Post by *ado »

You can still use Ctrl-F12 to create custom selection...I know it is not exactly you asked for, but at least it helps you to select set of files
Rogurt
Junior Member
Junior Member
Posts: 23
Joined: 2009-08-26, 09:26 UTC

Post by *Rogurt »

Is there a solution to this meanwhile? I would also really like to have file sequences collapsed in viewer for easy copying, renaming etc...
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

Here's a script that will do it.

Create a User-Defined Command:
Command: "C:\Program Files\AutoHotkey\Autohotkey.exe" "C:\Program Files\AutoHotkey\Scripts\TC_SelectSequence.ahk"
Assign the user-command to a TC-Shortcut key.
Such as, Shift+Win+s

Put the mousecursor on anyfile.
Press: Shift+Win+s

Code: Select all

;;
;;	TC_SelectSequence
;;	v1.03
;;	
;;	Balderstrom, Nov.2010
;;
	#SingleInstance, Force 
	#NoEnv
SetBatchLInes, -1
SendMode Input

#include %A_ScriptDir%\LB.ahk

;;
;; Remove "TC_SelectSequence()" if you enable the hotkey below.
;;
TC_SelectSequence()
return

TC_SelectSequence()
{
	aPanel:=QueryActivePanelID( cID1, cID2)
	aText:=LB_QueryText(aPanel, cPos:=LB_FindCursorPos( aPanel ))
	ControlGetText, aPath, TMyPanel3, A
	RegExMatch(aPath aText, "(.*)\>(.*\\)?([^\\]+)(\.[a-zA-Z]+) \>?", aFile)
	fileName:=aFile3
	fileExt :=aFile4
	;partPath:=aFile1 "\" aFile2
	;fullPath:=aFile1 "\" aFile2 aFile3 aFile4

	RegExMatch(fileName, "(.*\D)?(\d+)(\D+)?$", split)
	filter:="^" split1 "\d{" strlen(split2) "}" split3 "\" fileExt "$"
	PostMessage, 0x433, 521,,, A	; cm_SpreadSelection | Select group
	; Send, {NumPadAdd}
	WinWaitActive, Expand selection ahk_class TCOMBOINPUT
	ControlSetText, Edit1, TC_SelectSequence, A
	Send, !d
	WinWaitActive, Define selection ahk_class TFindFile
	Send, !x
	ControlSetText, Edit3, %filter%, A
	Send, !s
	WinWaitActive, Save parameters ahk_class TSTDTREEDLG
	ControlSetText, TAltEdit1, TC_SelectSequence, A
	Send, {Enter}
	WinWaitActive, Confirm overwrites ahk_class #32770,,1
	if( !ErrorLevel )
		Send, !y
	WinWaitActive, Expand selection ahk_class TCOMBOINPUT
	Send, {Enter}
	WinWaitActive, ahk_class TTOTAL_CMD
return
}

/*
 * If you want the hotkey in AHK, instead of TC. 
 * Uncomment this block.
 */
 /*
#ifWinActive, ahk_class TTOTAL_CMD
{
	+#s::TC_SelectSequence()
return
}
*/
Above code requires this file. Should be in the same directory (or change the #include path above).

Code: Select all

;;
;;	AutoHotKey Library File
;;	LB.ahk
;;		Version: 1.30
;;
;;	Balderstrom, Nov.2010
;;
;;	Notes: 
;;	  Can be manually included, or auto-included if it is placed 
;;	  in one of the standard AHK Library locations.
;;		
;;

QueryActiveWinID( byRef aWin, winText="", excludeTitle="", excludeText="" )
{
	if( (aWin || aWin:="A") && (aWin <> "A") && (subStr(aWin,1,4) <> "ahk_") ) 
		aWin:=(( RegExMatch(subStr(aWin,1,1), "\d") && !InStr(aWin, " ")) ? "ahk_class " aWin : "ahk_id " aWin )

return  aWin:=WinActive( aWin, winText, excludeTitle, excludeText )
}


ControlGetID( byRef cID, cName, wID="" )
{
	if( wID=="" )
		wID:=WinExist("A")
	ControlGet, cID, HWND,, %cName%, ahk_id %wID%
return cID
}

Swap( byRef v1, byRef v2, dx="" )
{
	v3:=v1,v1:=v2,v2:=v3
return (dx=="" ? TRUE : v%dx%)
}

QueryActivePanelID( byRef cID2, byRef cID1="", absolute=FALSE, force=FALSE )
{
	if(!winID:=WinActive("ahk_class TTOTAL_CMD"))
		return !(ErrorLevel:=2)
	dx:=( ControlGetID(cID3, "TMyListBox3", winID) ? 2 : 1)
	cID1:=ControlGetID(cID1, "TMyListBox" dx, winID)
	cID2:=ControlGetID(cID2, "TMyListBox" (++dx), winID)
	Loop, 2
	{
		ControlGetFocus, aCF, ahk_id %winID%
		cID3:=ControlGetID(cID3, aCF, winID)
		if( (!ErrorLevel:=!(cID3==cID2 || (cID3==cID1 && (absolute || Swap(cID1,cID2))) ) ) || !force)
			break
		Send, {ESC}
		Sleep, 0
	}
return (ErrorLevel ? 0 : cID3)
}


QueryFocusedCtrlID( byRef aControl, byRef aWin="", winText="", excludeTitle="", excludeText="" )
{
	if( !aWin || aWin=="A" )
		QueryActiveWinID( aWin, winText, excludeTitle, excludeText )
	if( !aControl )
		ControlGetFocus, aControl, ahk_id %aWin%, %winText%, %excludeTitle%, %excludeText%
	ControlGet, aControl, HWND,, %aControl%, ahk_id %aWin%
return aControl
}

QueryMouseGetPosID( byRef aControl, byRef aCName="", byRef aWin="", byRef x="", byRef y="" )
{
	MouseGetPos, x, y, aWin, aControl, 3
	MouseGetPos,,,, aCName, 1
return aControl
}


LB_FindCursorPos( byRef cID )
{
	LB_GETCURSEL = 0x188
	NULL = 0x0
	SendMessage, LB_GETCURSEL, NULL, NULL,, ahk_id %cID%
return ( ErrorLevel <> "FAIL" ? ErrorLevel + 1 : 0 )
}
LB_CountAllItems( cID )
{
	LB_GETCOUNT = 0x18B
	NULL = 0x0
	SendMessage, LB_GETCOUNT, NULL, NULL,, ahk_id %cID%
return ( ErrorLevel <> "FAIL" ? ErrorLevel : 0 )
}
LB_CountSelected( cID )
{
	LB_GETSELCOUNT = 0x190
	NULL = 0x0
	SendMessage LB_GETSELCOUNT, NULL, NULL,, ahk_id %cID%
return ( ErrorLevel <> "FAIL" ? ErrorLevel : 0 )
}


LB_QListSelected( cID, byRef count="", listDX=0, newList=FALSE )
{
	static
	local LB_GETSELITEMS = 0x191
	local currList

	if( cID<=0 && (currList:="selectList" (abs(cID))) && VarSetCapacity(%currList%, 0) )
		return
	currList:="selectList" listDX
	if( newList )
	{
		if( count=="" && !(count:=LB_CountSelected( cID )) )
			return 0
		VarSetCapacity(%currList%, count * 4, 0 )
		SendMessage, LB_GETSELITEMS, %count%, &%currList%,, ahk_id %cID%
	return
	}
	count:=NumGet( %currList%, (count - 1) * 4)
return (LB_QueryText( cID, count ))
}

LB_QueryText( cID, cPos )
{
	LB_GETTEXT = 0x189
	VarSetCapacity(text,1024)
	SendMessage, LB_GETTEXT, % cPos - 1, &text,, ahk_id %cID%
return text
}
v1.02 :: Removed Loop
v1.01 :: Minor Regex Fix
Last edited by Balderstrom on 2010-11-10, 23:54 UTC, edited 3 times in total.
Rogurt
Junior Member
Junior Member
Posts: 23
Joined: 2009-08-26, 09:26 UTC

Post by *Rogurt »

Hello Balderstrom

Unfortunately I dont quite understand. Do you refer to the open source program autohotkey (http://www.autohotkey.com/) and assume I have that installed on my machine? Then the command is a windows command created with autohotkey or is it a TC user defined command? But if it is a TC command then why would I need "autohotkey" be installed?

The 1rst piece of code is the "TC_Select_Sequence.ahk", no? Then the 2nd code would have to be named "LB.ahk" (which you say has to be in the same folder as 1rst code).

You say:
Put the mousecursor on anyfile.
Press: Shift+Win+s
Do you mean inside of TC or in any Explorer Window (which the use of "autohotkey" might suggest)?

And last but not least: Can I just copy/paste the code in an .txt file and rename that to .ahk? Sorry for my incompetence...

Thanks a lot for U trying to help me in the first place.

Regards
Rogurt
User avatar
nsp
Power Member
Power Member
Posts: 1818
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

Rogurt wrote:Is there a solution to this meanwhile? I would also really like to have file sequences collapsed in viewer for easy copying, renaming etc...
Nope in standard !
If it exist a solution it could only be done in a filesystem plugin and you will lose tons of features. :(

Balderstrom gave you a solution to auto select a sequence and not to colapse it as a folder
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

Yes, the solution is for selecting of files that match in name.
It will work when folders are flattened with SubDirBranchView or just a regular file view.
It also works when you use a custom Column display.

And yes you would need to install AutoHotKey, afaik it comes as a zip file, and can be placed/unpacked anywhere.
The 2 blocks of code above are 2 files, you can name them as you wish, but to work without any changes to the instructions they would need to be named TC_SelectSequence.ahk and LB.ahk

I have mine installed in %ProgramFiles%\AutoHotKey
I added a directory there, called Scripts -- as opposed to placing scripts in MyDocs or in TC's various folders.

For example it will select all the following if the cursor is just on one of the files:
A Set 4 of Files Cateogry 7 001.txt
A Set 4 of Files Cateogry 7 001.txt
A Set 4 of Files Cateogry 7 004.txt
A Set 4 of Files Cateogry 7 006.txt
Or files that are more in line with Digital Cameras:
GEDCX8001.jpg
GEDCX8002.jpg
GEDCX8003.jpg
GEDCX8004.jpg
GEDCX8005.jpg
The code creates a Filter called, TC_SelectSequence
And a regex to match the files, in the cases above:
Regex: "^A Set 4 of Files Category 7 \d{3}\.txt$"
Regex: "^GEDCX\d{4}\.jpg$"
It also will match if there are characters following the last number sequence: So long as there are no numbers there.
Eg: GEDCX8004__.jpg

What could probably added to it is a user intervention PopUp Question for when the sequence is more likely one set and not the other. For instance, selecting a file such as:
TestFile001__(1).foo, will match the '1' inside the braces, which is likely not the users intention (though it might be).

The code could either 1) have a settable flag to ignore numbers inside {([ braces/brackets -- when there is a previous match, or popUp to ask the user which number they want to match.

Although aside from that one odd case, the matching strings work for everything else I tossed at it.

Note:
AHK scripts CAN be compiled into binaries. And then the user doesn't need to have AHK installed. But I don't distribute code like that. I find it is more useful to have it "open" and if someone is so inclined they can easily make changes. Also it enables others that are inclined to do so - to learn from existing code. Unlike most of TC's plugins that are distributed without source(s) - you need to constantly reinvent the wheel anytime you might want to create a plugin that is similiar to a pre-existing plugin.

The LB.ahk is what is known as an AHK Library File. Everything in that file is related to manipulating ListBoxes. Thus you can include it into a new script and just focus on the script at hand instead of needing to figure out how to handle list boxes again and again. As a library file, it will over time accumulate more functions related to list boxes. And when I get my code organized better, I'll update TC's wiki for my TC related files, and libraries.
Last edited by Balderstrom on 2010-11-10, 19:06 UTC, edited 2 times in total.
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

I doubt we will ever see something like an editor's code blocks

Code: Select all

[+] if( x )
  |  {
  |       SomeCode;
  |- }
for "file sequences", though as NSP said it might be possible as a fileSystem plugin --- there would need to be qualified usage for it.

Personally I wouldn't have a use for such, nor have I gotten around to learning how to create TC plugins. I find it offputting there are no forum resources directed towards creation/troubleshooting/help Q&A for plugins: there is only a single forum for promoting a plugin you've already created.

This selection sequence, automates one of the tedious parts of creating a regex for a group of files. And once you have what files you want selected you can do various things:
1) Invert Selection
2) Save Selection (to file) (so you can resume the selection later)
3) Show only Selected files.
OR:
1) Show only Selected files.

The first 3 step command, could be done with TCMC.exe or a very small AHK script, and assigned to an EM_ command or button.
Rogurt
Junior Member
Junior Member
Posts: 23
Joined: 2009-08-26, 09:26 UTC

Post by *Rogurt »

Thanks a lot for your explanations. I really like your approach of coding. Unfortunately I am not into programming more the sort of "power-user" so I might just leave it untweaked...
Selection of sequences with your script will get really fast which is half the way to go. With 3D Rendering there a tons of file sequences consisting of hundreds or thousands of images each. So there´s a big need to get an overview. And for this it would be sufficient to just see the first file of a sequence, select it and have the whole sequence selected (with your "short cut").
I will have a try if when filtered by "just show files with *0001* in the name" your command will work as expected. Maybe not but if it does I have achieved what I need with 2 commands which is still good.

Regards
Roger
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

TC_SelectSequence.ahk (Version 2.20) posted to Plugins forum Auto-Select Files (matching NumericalSequence) [AHK]
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

Version 2.20, as noted above. Placed (more appropriately) into plugins forum.
Post Reply