Hi,
I’m working on submitting jobs to deadline without the UI, So I’ve followed the Custom Maxscript Submission Tutorial and I got a script working that will submit a job to Deadline with custom details. I want to add it to a library of functions that I run at startup but I seem to be having trouble when I first load it up. I keep getting the same error.
-- Error occurred in SubmitDeadline(); filename: C:\Program Files (x86)\Autodesk\3ds Max 2008\scripts\startup\ZSL_Scripts\SL_Functions.ms; position: 1209
-- Frame:
-- initialArgs: undefined
-- JobInfoFile: undefined
-- SubmitInfoFile: undefined
-- result: undefined
-- renderMsg: undefined
-- SMTDPaths: undefined
-- JobSettings: #("Test Comment", 10, "Test Pool", "Test Department")
-- maxFileToSubmit: undefined
-- Unknown property: "tempdir" in undefined
The line it errors on is “local maxFileToSubmit = SMTDPaths.tempdir + maxFileName”
Once I’ve re-evaluated the script after Max has started up it seems to work again.
The file is in my scripts/startup folder. I wondered if my functions were being evaluated at startup before the SMTD stuff and so it wasn’t finding the SMTD variables but that installs to UI/Macroscripts which I believe evaluates first on startup?
The functions code is below, I’ve split the connection and submission into two functions because I’m submitting multiple jobs at the same time. To execute the functions I’m running:
[code]SubmitSettings=#(“Test Comment”,10,“Test Pool”,“Test Department”)
sl_smtd.CONNECTDEADLINE()
sl_smtd.SUBMITDEADLINE SubmitSettings[/code]
[code]global SL_SMTD
struct SL_SMTD
(
fn ConnectDeadline =
(
global SMTDSettings
global SMTDFunctions
local theResultFile=getDir #temp + "\\_result.txt"
local theCommandLine=("deadlinecommand.exe -getrepositoryroot > \""+theResultFile +"\"")
hiddenDosCommand theCommandLine startpath:"c:\\"
local theFileHandle=openFile theResultFile
local theNetworkRoot=readLine theFileHandle
close theFileHandle
local remoteScript=theNetworkRoot+@"\submission\3dsmax\SubmitMaxToDeadline_Functions.ms"
local localScript=getDir #scripts + "\\SubmitMaxToDeadline_Functions.ms"
if doesFileExist remoteScript then
(
if SMTDFunctions == undefined do
(
deleteFile localScript
copyFile remoteScript localScript
fileIn localScript
)
)
else format "Failed to find [SubmitMaxToDeadline_Functions.ms] in the Repository!\n"
),
fn SubmitDeadline JobSettings =
(
SMTDFunctions.loadSettings()
SMTDSettings.Comment = JobSettings[1]
SMTDSettings.Priority = JobSettings[2]
SMTDSettings.poolname=JobSettings[3]
SMTDSettings.Department=JobSettings[4]
local maxFileToSubmit = SMTDPaths.tempdir + maxFileName
SMTDFunctions.SaveMaxFileCopy maxFileToSubmit
local SubmitInfoFile = SMTDPaths.tempdir + "\\max_submit_info.job"
local JobInfoFile = SMTDPaths.tempdir + "\\max_job_info.job"
SMTDFunctions.CreateSubmitInfoFile SubmitInfoFile
SMTDFunctions.CreateJobInfoFile JobInfoFile
local initialArgs = "\""+SubmitInfoFile+"\" \""+JobInfoFile+"\" \""+maxFileToSubmit+"\" "
local result = SMTDFunctions.waitForCommandToComplete initialArgs SMTDSettings.TimeoutSubmission
local renderMsg = SMTDFunctions.getRenderMessage()
SMTDFunctions.getJobIDFromMessage renderMsg
if result == #success then
(
format "Submitted successfully as Job %.\n\n%\n\n" \
SMTDSettings.DeadlineSubmissionLastJobID renderMsg
)
else
format "Job Submission FAILED.\n\n%" renderMsg
)--end script
)[/code]
Any help or suggestions anyone might be able to offer would be greatly appreciate.
Nick