Path definitions, searching for substring

Hi everyone,

I am trying to set up an if statement in an anyscript file which is dependent on either finding a certain substring from a filepath or comparing two filepaths (if filepath01 == filepath02...). Is there a way to do this using anyscript functions? It seems simple enough, but I have not been able to find what functions I would need or the syntax they require to accomplish this.

Let's say the main file is located here on my computer: C:\Users\user1\Documents\AnyBody\Study1\Subjects\P1\ InExo \P1_trial1\Main.any.

Is there a way that I could check whether the substring "InExo" was in the main file's filepath by extracting the filepath as a string from its path statement ANYBODY_NAME_MAINFILEDIR, and then trying to find the substring I am looking for?

If there is no way to find a substring within a path, is there another work around that anyone could suggest?

Thank you!

Lindsay

Hi Lindsay,

I am not sure this is possible to do directly in AnyScript, there might be a way but i can not think of it.

What you could do would be to use the python hook and send the filename to a python function which would then return a value if the string contained the "InExo". This will not allow you to do topological changes to the model depending on this value, but you can alter values.

Best regards
Søren

This topic was automatically closed 125 days after the last reply. New replies are no longer allowed.