Write node filename from connected read node using switch
[regsub "\\.dng$" [file dirname [value [topnode Switchnode.input[value Switchnode.which]].file]]/optionalFolder/[file tail [value [topnode Switchnode.input[value Switchnode.which]].file]] ".%04d.jpg"]
https://learn.foundry.com/nuke/8.0/content/user_guide/metadata/accessing_metadata_tcl.html
#parent.knob(framenumber) will return the value at the particular frame
# width - gives the format width of the given input of the current node
# height - gives the format height of the given input of the current node
# x,y,frame - gives the current frame
# clamp(value,min.max) - clamps the given value to the min and max
# Simply referencing any knobName is same as the parent.knobName when working inside group node
#in expression node "x" is the X coordinate of every pixels it wont give you the current frame
same applies for "y"
#in expression node channel(x,y) will gives you the value of the given channel at the given 2d position x,y
#Quick stmap with Expression node
x/width in r
y/height in g
0 in b
#averaging Nans
isnan(r)?r(x+1,y):r