Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using folder pathname, save all image files and file names

I trying to create a 360 degree animation from In Design-to-HTML conversion.

I get the folder name, and inside that folder are 50 to 80 images. I need to save those images in my folder, and to save each image name inside the script.

Here's my code:

var doc = app.activeDocument;
for (var j =0; j< doc.rectangles.length; j++) {  
    var nav = doc.rectangles[j].extractLabel("",);
    alert("Nav length "+nav.length);   
    for(var nav_get_name =0; nav_get_name < nav.length; nav_get_name++) {
       alert(nav[nav_get_name][0]+"="+nav[nav_get_name][1]);      
       var path_name =  (nav[2][1]);          
    }
}
like image 962
NaveenDAlmeida Avatar asked Sep 01 '12 10:09

NaveenDAlmeida


1 Answers

It looks like you'll want to call the place method.

Putting something like this in your innermost for loop should work provided inDesign allows multiple items to be attached to the same rectangle.

doc.rectangles[j].place(path_name);

If you're running on Windows, you'll want to run this regex first to escape the backslashes in the path (if they aren't already).

path_name.replace(/\\/g, "\\\\\\");
like image 121
Dave Snigier Avatar answered Nov 11 '22 04:11

Dave Snigier