Notifications
Clear all

[Closed] Running a relatively pathed .ms on file open

Hi everyone.

I have a file test.max which is in the same directory as test.ms.
The location of this folder files will vary on different peoples computers (but the two files will always be in the same folder).
When test.max opens I want it to automatically run test.ms
I did this via


callbacks.addscript #filepostopen fileName:(maxfilepath + "test.ms")
id:#SceneNote persistent:true

This works fine on my machine but not on others because when you have a look at the script via callbacks.show(), it shows that the file is absolutely pathed. I thought the section “fileName:(maxfilepath + “test.ms”)” was evaluated every time the file is opened but obviously not.


filePostOpen:
 fileName:C:\mf_testworld	est3dsourcefiles\batchable_exporter_test_files\res\exporter_test_files	estmaxfiles	est.ms

So, does anyone know how I could get this test.ms to run no matter where it and the max file are put?

Regards,

1 Reply
 lo1
callbacks.addscript #filepostopen "fileIn (maxFilePath + \"test.ms\")" id:#SceneNote persistent:true

Have the script evaluated at runtime.

I’d also add a check to make sure the file exists, no one likes an exception.