PYTHON get name of the file top 'movie in '

I use ’ movie file in ’ i want to get the name of the file in the par. ‘file’
example of a path
F:/…/BACKGROUND/Mode_veille/003_SNOW_Fullsize_2.mov

#check the name in file ‘file movie in’
number_end=op( ‘file movie in’).file.name ???
#get the last digit of the name
number_end=op( ‘file movie in’).file.name.val[ -5:-4 ]

the part that do not work is .file.name
but i don’t know what is the correct formulation

what I want is number_end=2

Thanks

You want to use:

op( 'moviefilein1' ).par.file

This should evaluate as the file path, but there’s a chance it’ll be a parameter object.

str( op( 'moviefilein1' ).par.file )

If the above doesn’t work, explicitly casting the value to a string will ensure that you get a string path instead of the parameter object.

As long as you only have a single digit this should work:

str( op( 'moviefilein1' ).par.file )[-5:-4]

That python reference will break if your digits are longer than 0-9, a number like 22 (for example) will break this.

You may also want to use the handy built in ‘digits’ function:

python >>> s ='F:/.../BACKGROUND/Mode_veille/003_SNOW_Fullsize_2.mov' python >>> tdu.digits(s) 2

Expanding on the example above it would be:

tdu.digits(op( 'moviefilein1' ).par.file)

This will work for any string of digits.
More info:
derivative.ca/wiki099/index … le#Methods

ROB! This is amazing, I didn’t realize that digits was accessible this way across all of Touch. Really killer, thanks for sharing this.