Here is the TCL code (see attached). Please note that you need to have both TCL procs work in tandem with each other to capture file name into a global variable first and then populate USERDATA meta data field with the value of that global in the second proc. See attached screenshots for proc placement.
Hopefully this helps.