top of page


This page is a collection of native TCL functions that you can use in Nuke in different ways. I show them with description used in a Text node referencing a Read node`s file value, but you can use it many other ways.

Some of these functions are more useful than others, but it is always better to have a wider range of tools as in VFX you just never know what the next task might be.


If this is your first time using TCL in Text node what is important to remember is that you need to put the code between "["  "]" brackets, like [topnode]. Also, I recommend my other page with a general introduction that you can find HERE.

Base functions

These are the functions that we will need to get started.


Gives you the top node`s place in a memory.

(It has little use in this form but we will use it as a base for the rest of the functions.)


Gives you the full name of the top node.

[full_name [topnode]]

Gives you the `file` value of the top node.

[filename [topnode]]

Gives you the `file` value of the top node.

[knob [topnode].file]

Gives you the `file` value of the top node.

Notice if you use a `value` function you get a frame number too.

[value [topnode].file]

File functions


Returns a name comprised of all of the path components in name

excluding the last element. - More Info

[file dirname [value [topnode].file]]

Returns all of the characters in the last filesystem

component of name. - More Info

[file tail [value [topnode].file]]

Returns all of the characters in name after and including the last

dot in the last element of name. - More Info

[file extension [value [topnode].file]]

Returns the platform-specific name

of the file. - More Info

[file nativename [value [topnode].file]]

Returns one of absolute, relative, volumerelative. If name refers to a specific file on a specific volume, the path type will be absolute. If name refers to a file relative to the current working directory, then the path type will be relative. If name refers to a file relative to the current working directory on a specified volume, or to a specific file on the current working volume, then the path type is volumerelative.

- More Info

[file pathtype [value [topnode].file]]


Returns all of the characters in name up to but not including the last “.”

character in the last component of name. - More Info

[file rootname [value [topnode].file]]

If no argument is given, returns the character which is used to separate path segments for native files on this platform. - More Info

[file separator [value [topnode].file]]

Returns a list of one or two elements, the first of which is the name of the filesystem to use for the file, and the second, if given, an arbitrary string representing the filesystem-specific nature or type of the location

within that filesystem. - More Info

[file system [value [topnode].file]]

Returns 1 if file name is writable by the current user,

 0 otherwise. - More Info

[file writable [value [topnode].file]]

String functions


Returns the charIndex'th character of the string argument. A charIndex of 0 corresponds to the first character of the string. - More Info

[string index [value [topnode].file] 0]

Returns a value equal to string except that all upper (or title) case

letters have been converted to lower case. - More Info

[string tolower [value [topnode].file]]

Returns a value equal to string except that all lower (or title) case

letters have been converted to upper case. - More Info

[string toupper [value [topnode].file]]


Returns a decimal string giving the number of characters in string. - More Info

[string length [value [topnode].file]]

Returns a range of consecutive characters from string, starting with the character whose index is first and ending with the character whose index is last. - More Info

[string range [value [topnode].file] 0 20 ]

Replaces characters in string based on the key-value pairs in {}. - More Info

[string map {"Projects" "xx" "Alagut" "yy"} [value [topnode].file]]

Perform a character-by-character comparison of strings

string1 and string2. - More Info

[string equal [value [topnode].colorspace] "Cineon"]

List functions

When we ask for a value of the Read node`s 'file' knob we get

a string. In order to operate list functions on it we need to use a 'split' function

first that separeates the elements at a given symbol.


 This command will return a new list consisting of elements first through last, inclusive. The index values first and last are interpreted the same as index values for the command string index, supporting simple index arithmetic and indices relative to the end of the list. - More Info

[lrange [split [file tail [knob [topnode].file]] _ ] 0 1 ]

The lindex command accepts a parameter, list, which

it treats as a Tcl list. - More Info

[lindex [split [knob [topnode].file] /] 4]

You can use `end` to call the last item of the list.

[lindex [split [knob [topnode].file] /] end]

You can also use minus the step backward from the last item

[lindex [split [knob [topnode].file] /] end-1]

Treats list as a list and returns a decimal string giving the

number of elements in it. - More Info

[llength [split [knob [topnode].file] /]]


This command sorts the elements of list, returning a

new list in sorted order. - More Info

[lsort [split [knob [topnode].file] /]]

This command searches the elements of list to see if one of

them matches pattern. - More Info

[lsearch [split [knob [topnode].file] /] 05]

This command produces a new list from list by inserting all of the element arguments just before the index'th element of list. - More Info

[linsert [split [knob [topnode].file] /] 5 Something]

This command returns the string formed by joining all of the elements of list together with "/" separating each adjacent

pair of elements. - More Info

[join [linsert [split [knob [topnode].file] /] 5 Something] "/"]

Treturns a new list formed by replacing zero or more elements

of list with the element arguments. - More Info

[lreplace [split [knob [topnode].file] /] 1 1 Something]

Useful combinations


[file dirname [value]]/NewName.dpx

[join [lrange [file split [value [topnode].file]] 0 7] /]

[join [lrange [split [value [topnode].file] .] 0 end-2] .].%04d.dpx

[basename [value [topnode].file ]]

[lindex [split [lindex [split [knob [topnode].file] .] 0] /] end]

[lindex [split [lindex [split [lindex [split [value [topnode].file] /] end] _] end] .] 0]

Hope you will find it useful! 

bottom of page