include function ERROR = '-- Compile error: include expected filename string' [SOLVED]
Hi all,
This works:
srchDir = GetDir #scripts scripts = getfiles (srchDir + "\\" + "CoronaConverter_v*.ms") sort scripts CoronaConverterlatest = scripts[scripts.count] global CoronaConverterGUI = try(CoronaConverterNoGui = true)catch() global CoronaConverterMacro = try(macros.run "Corona Renderer" "CoronaConverter")catch() if CoronaConverterMacro != false then ( CoronaConverterlatest try(include "C:\Program Files\Autodesk\3ds Max 2015\scripts\coronaConverter_v1.12.ms")catch() try(CoronaConverter.destroyGui())catch() StartCoronaConverter CoronaConverter.converterSettings.switchRenderEngine = true CoronaConverter.converterSettings.printInfo = true CoronaConverter.converterSettings.silent = true CoronaConverter.converterSettings.useTryCatchBugReporting = true CoronaConverter.converterTools.resetMtlEdit() CoronaConverter.converterTools.SetMaxDisplacementLevel 1.0 CoronaConverter.converterTools.showMapsInVP true CoronaConverter.convertScene() ) gc()
But when I change:
try(include "C:\Program Files\Autodesk\3ds Max 2015\scripts\coronaConverter_v1.12.ms")catch()
To:
try(include CoronaConverterlatest)catch()
It doesn't work with the error described in the subject.
Although running:
CoronaConverterlatest include CoronaConverterlatest
after the fact runs just fine.
Has anyone came across a similar problem before. Thanks.
Script which this code runs is found on the Corona forum here & here:
https://corona-renderer.com/forum/index.php/topic,126.0.html
http://www.racoon-artworks.de/?p=154
Comments
still waiting for the
still waiting for the ultimate solution that will work independently, hoping that its on its way and will show by eventually.
Thanks but this but it comes
Thanks but this but it comes back with the same type error. I think its from running it inside the then ()
WORKS:
DOESN'T (This is strange) (just the single lines blocked swapped)
Does the script variable need to be made a global do you think?
`
I don't have corona installed, check where is the CoronaConverter_v1.12.ms file located.
maybe not in #Scripts but #UserScripts
It's in the right place all
It's in the right place all right. In scripts inside the max directory.
`
oki, try this:
I think you forgot about folder \CoronaRenderer\
`
oki, I found this: after Include can be only string literal in ""
maxscript help :"... file name specification must be a string literal, and not a variable or an expression."
what you can do is find newest filename, create temporary include script with found name and include it into your code:
whole code will look:
I tried with format to string stream and execute it, but this didn't work :(
with extra include it look like it should work.
You are my hero... I seen
You are my hero... I seen that string literal issue in the help, I wrote that in the 2nd post but maybe you missed that.
I never thought of writing it to a temp.ms file.. Fantastic work and help again my friend.
From max help
Only spotting this now:
"This is a compile-time construct, therefore the file name specification must be a string literal, and not a variable or an expression."
This means that it has to be either:
include "C:\Program Files\Autodesk\3ds Max 2015\scripts\coronaConverter_v1.12.ms"
or
include "coronaConverter_v1.12.ms"
?????
What if this name changes is it possible by other methods to assign the filename like:
EDIT: Although this doesn't seem to work either. :[
`
hey, try this:
scripts = getfiles (pathconfig.normalizepath(strDir + "\\CoronaConverter_v1*.ms"))
just add "*" before ".ms"
than you can do
if scripts.count > 0 then include scripts[1]
or last one (possibly newest one)
if scripts.count > 0 then include scripts[scripts.count]