split does not work here

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
payton
Posts: 10
Joined: January 30th, 2009, 4:11 pm

hi folks,
im trying to split a footage path into an array on windows. but with no luck:

Code: Select all

var selItems = app.project.selection;
if (selItems.length > 0){
	for (i=0; i < selItems.length; i++){
		var footagePath=selItems[i].file;
		alert (footagePath);
		var splitFootagePath = footagePath.split("/");
		alert (splitFootagePath);
	}
} else {
		alert("Error");
}
this line:

Code: Select all

var splitFootagePath = footagePath.split("/");
causes this error:
Unable to execute script at line 6. Function footage.split is undefined
any help?

thanks in advance,
payton
Dan Ebberts
Posts: 320
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

I think your footagePath is actually a file object. Try this:

var footagePath=selItems.file.path;


Dan
payton
Posts: 10
Joined: January 30th, 2009, 4:11 pm

hi dan,
that works!
thanks for this.

i found another solution that works, but dont know why:

Code: Select all

var footageLocString=footageLoc.toString();
why this wasn't a string before, and what is the difference between the path and file (except the filename)?

anyway, it works!

cheers,
payton
Post Reply