ScriptSpot

Forum topic · General Scripting

Filename String with include ""

By bragibjornson · 2012-02-10

Description

This might be a relatively easy question, but I am stumped. I am trying to reference a .ms of functions into another script, which runs the functions.

I am using the include "filename_string" and I am having some difficulty.

I can get this to work:

include "C:\Users\(hardcodeusernamehere)\AppData\Local\Autodesk\3dsMax\2012 - 64bit\enu\scripts\Custom\Submission_Lib.ms"

but not this:

include (("C:\\Users\\" + sysInfo.username + "\\AppData\\Local\\Autodesk\\3dsMax\\2012 - 64bit\\enu\\scripts") + "\\Custom\\" + "Submission_Lib.ms")

i can get this to work (prints right value):

thepath = (("C:\\Users\\" + sysInfo.username + "\\AppData\\Local\\Autodesk\\3dsMax\\2012 - 64bit\\enu\\scripts\\Custom\\Submission_Lib.ms") as string)
print (thepath as string)

but not this:

thepath = (("C:\\Users\\" + sysInfo.username + "\\AppData\\Local\\Autodesk\\3dsMax\\2012 - 64bit\\enu\\scripts\\Custom\\Submission_Lib.ms") as string)
include (thepath as string)

Any Ideas? Thanks!

Comments (2)

Use sysinfo.currentdir

Kstudio · 2012-02-13


sysinfo.currentdir = getDir #userScripts + @"\TrackScripts\")
include "myScript.ms"

path = getDir #userscripts +

jos · 2012-02-10


path = getDir #userscripts + "\Submission_Lib.ms"
include path

this works fine for me..

 
getDir #userscripts
"C:\Users\Jos\AppData\Local\Autodesk\3dsMax\2012 - 64bit\enu\scripts"