Import into folder not working

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

I'm importing some files and I want them to go into a folder I have specified but it is not working. Here's my code:

Code: Select all

		
//get the currently selected items
var selectedItems = app.project.selection;

// Loop through the selection and deselect everything
		for (var i = 0; i < selectedItems.length; i++){ 
			selectedItems[i].selected = false;}

   //reselect the photo folder. this var was set earlier in the script
   //it is a folderitem in the project
		photoFolder.selected = true;

		//Setup options and import the file from folder
		//compData array contains the file info and some other data
      var myfile = compData[2];
		var myIO = new ImportOptions(myfile);
		myIO.importAs = ImportAsType.FOOTAGE;
		proj.importFile (myIO);

		//set variable for newly imported item
		var curSel = proj.selection;
		var newImport = curSel[0];
I thought you could deselect everything, then select the folder you wanted your items to import into, but it's not working. All my items go to the project root.
mads
Posts: 33
Joined: October 15th, 2004, 6:38 am
Location: Denmark
Contact:

I haven´t been able to figure it out either so I
use this Hack way to Import bitmaps into a folder, and even avoid the pop up screen when importing .psd.

-rename all Folders in Project Named 'Solids' to 'tempSolids'
-make a temp Composition
-put as many solids in the composition as the number of files you want to import
-find the newly created Folder 'Solids'
-replace the solids in the Folder Solids with the desired Files
-rename Folder 'Solid' to your personel choise
-delete temporary Composition
-rename all Folders named 'tempSolids' to 'Solids'

don't know if its any help
mads
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

Thanks for the tip, I'll see if I can get it implemented into my script. Have you figured any way to get files into an existing folder?
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

I found a workflow based on your suggestion. If you have an existing folder you would like to import files into, you can follow these steps.

-rename all Folders in Project Named 'Solids' to 'tempSolids'
-rename the folder you want to import into to "Solids"
-make a temp Composition
-add a solid to the comp
-replace the solid source with a file
-delete temporary Composition
-rename the "Solids" folder back to the orginal name
-rename all Folders named 'tempSolids' to 'Solids'


This is nice if you have a script that does some work on an existing project.
Post Reply