Hi I have a rollout with a few buttons and editText. The buttons is for getting a path and the editText is to display the path. The problem is when I press the button to get a CSV-file I get an error the first time. But if I run the script again there is no error. I would be realy greatfull if someone could help me!
Here is part of the code that is causing the error:
button setCsvPath "CSV" pos:[7,5] across:2
editText csvPathText pos:[65,8] fieldWidth: 200
on setCsvPath pressed do
(
csvPath = getOpenFileName caption:"Select CSV" types:"List(*.csv)|*.csv"
if csvPath != undefined then
(
global csvFile= openFile (csvPath) mode:"r"
csvPathText.text = csvPath
countLines (csvFile)
collectObj()
)
)
fn countLines file =
(
orgFilePos = filePos file
seek file 0
while not eof file do
(
numLines += 1
skipToNextLine file
)
seek file orgFilePos
)
Here is the error:
countLines: undefined
>> MAXScript Rollout Handler Exception:
-- Type error: Call needs function or class, got: undefined <<
miauu · 2013-08-20