Export scene (fbx) with texture paths relative to max scene file


I’m trying to export fbx with maxscript and relative paths to textures.
I’ve made a script which does it, but it won’t save relative paths.
So I export my scene with export dialog, and it does save relative paths.
After I save my scene with dialog, the script I made starts save my scene with relative paths too.
Now when I open another scene my script one again won’t save relative paths - I have to do it with dialog and script will save relative paths again.

I think export dialog does something to 3ds max or to the current state of the scene which I can’t perform with a script!

So, the question is how to save relative paths with a script.

p.s. I’ve tried to set current project folder to the folder of my .max file scene, but it does nothing. Please help me.