Notifications
Clear all

[Closed] Error in CSV reading script

I’m getting an error in the “theDummy.position.controller.percent = (readValue theFile)” line: “Unknown Property: “Position” in undefined”. I have tried using .pos as well and keep getting the error.

What I’m trying to do is read a CSV file that I’ve calculated the “Time” and “Percent” along a path with. This script should automatically insert those values in the animation, but obviously I’m getting an error. Any ideas?

(--start a local scope.
  --pick the file:
  local theFilename = getOpenFileName types:"Comma Separated Values (*.CSV)|*.CSV|All Files (*.*)|*.*"
  if theFilename != undefined do ( --if a valid filename picked,
  	local theFile = openFile theFilename --open the file
  	local theDummy = Dummy005 --set dummy
  	while not eof theFile do ( --loop until the end of tile
  		theTime = (readValue theFile) --read the time
  		with animate on --enable autokey animation context
  			at time theTime  --set the current time for the following expression
  				theDummy.position.controller.percent = (readValue theFile)
  	)--and read the percent from the file for each time step
  	close theFile --close the file when done
  )--end if
  )--end script
3 Replies

I think you forgot a dollar sign ($) in this line:

local theDummy = Dummy005 --set dummy

Assuming that an object named Dummy005 exists, it should be:

local theDummy = $Dummy005 --set dummy

hopefully it fixed your problem

oops. i’m late…

That was it, thanks a lot! Simple mistake, easy fix.