ScriptSpot

Forum topic · General Scripting

Passing a variable into a path name

By ce89 · 2012-02-12

Description

I'm still quite new to scripting in general so this could be totally wrong what I'm trying to do?

In the addNewXRefFile i am trying to replace the maxFile name with a variable holding that name. Not sure why it doesn't work or even if it's possible?

newMod= "test.max"
xrefs.addNewXRefFile "C:/Desktop/newMod"

Any help would be much appreciated.

Thanks

Comments (2)

jos · 2012-02-12

if you write something between "" its a string. So maxscript doesnt know "newMod" like this is a variable.
you can test this in the listener.
if you want to a variable to a string write this:

newMod = "test.max"
newXRefFile = "C:/Desktop/" + newMod
xrefs.addNewXRefFile newXRefFile

write each line in the listener and check what you're trying to do

ce89 · 2012-02-13

thanks jos,

these answers always seem simple afterwards. :)