PDA

View Full Version : simple lscript problem



janrog
05-12-2009, 09:23 AM
hi all

a simple problem hopefully someone can solve for me. i'm tying to save all objects in a scene into a new folder via lscript...

item = Mesh() || error("No mesh.");

reqbegin("Target for AO...");
c1 = ctlfilename("Open Object", "(none)", 70, 20);
return if !reqpost();
sel = getvalue(c1);
reqend();

while(item)
{

objName = item.name;

SelectItem(item.id);
SaveObject(sel+objName+".lwo");

info(item.filename);
item = item.next();
}


the script i've written falls over when it comes across an item in the scene which is actually an object layer. it just says 'error, can't save object...'

i guess i'm missing something pretty simple here?


also, anyone know how to use the requester to return a folder location instead of a file location?


thanks,
Jan.

evenflcw
05-12-2009, 12:09 PM
Use debug(); Put it at the top of the script and step through it one row at a time (F10).

With layers, the automatic naming convention is [filename]:[layername], and that's likely what's causing you trouble. Windows (or whatever OS your using) don't like colons in filenames.

janrog
05-13-2009, 08:33 AM
Thanks Dan, it was the colon that was preventing the object save.