Notifications
Clear all

[Closed] Filterstring SplitemptyTokens:true giving me extra tokens?

I’ve got a script which breaks down a filepath into sections, analyises it’s name then puts it back together in a new form.

All works fine, however if my split token is duplicated it doesn’t work… ie “file_a__01” and the token is “_”, I get the following tokens returned #(“file”, “a”, “01”) So logically if I use the splitempty tokens parameter then I should get tokens of: #(“File”, “a”, “”, “01”)…

This works with a test string, but however when I’ve picked my file using getOpenFileName() and run the same code I get a bunch of empty tokens at the end of the of the filename for some reason…
ie… “file_a__01” split to tokens with empty tokens:true, results in #(“file”, “a”, “”, “01”, “”, “”, “”)

Anyone come across this behaviour before? Any ideas what is causing it?

2 Replies
 lo1

works fine for me.
what do you get when you print the string returned from GetOpenFileName() ?

If I print it, I get the filepath, with no extra _’s on the end…

print thefile
“X:\xx\Jobs\00_0000_ABCdefg_hijklmn_op_qrst\05_Post-Production\xxxxxxxxx\scxxx\sxxx\xxx_Highres\xxx_xxx_xxx_xxxxxx_01_xx\VRayZDepth_VRayZDepth\xxx_xxx_xxx_xxxxxx_01__VRayZDepth_tile_7x10_15x15_0000.tga”

(Worth saying I’m on 3dsmax 9 still…)

It doesn’t always happen… I’m going to write some form of function to clean the tokens, make sure there are no extra ones on the end that are not needed, annoying though…