Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Getting the File Name from an Embedded Link

$
0
0

Hi All,

 

I'm using the below code to get the raster item (file name) for the embedded links in an artboard.

But I am facing the below issues.

1) if any link is missing then the script is not running

2) if the files are not in the respective path (say if a single file even though embedded not available in the path mentioned) am getting the error.

 

Below is the code am using,

       for (var i = 0, l = doc.artboards.length; i < l; i++)       {             doc.artboards.setActiveArtboardIndex(i);             doc.selectObjectsOnActiveArtboard();             $.writeln("doc.rasterItems.length ",doc.rasterItems.length);            for (var iSelectedItems=0; iSelectedItems<doc.rasterItems.length; iSelectedItems++)                   {                             var topLeftPosDoc= doc.rasterItems[iSelectedItems].position;                                try                                {                                         $.writeln("doc.rasterItems[iSelectedItems].file.name    ",doc.rasterItems[iSelectedItems].file.name);                                         $.writeln(":::::IN getFileName() function:::::: doc.rasterItems[iSelectedItems].file.name  :::::"+doc.rasterItems[iSelectedItems].file.name);                                         var boundingRectanglePath = doc.pathItems.rectangle(doc.rasterItems[iSelectedItems].visibleBounds[1],                                                                              doc.rasterItems[iSelectedItems].visibleBounds[0],                                                                              doc.rasterItems[iSelectedItems].width,                                                                              doc.rasterItems[iSelectedItems].height);                                        boundingRectanglePath.filled = false;                                        boundingRectanglePath.stroked = true;                                          var color = new RGBColor;                                        color.red = 0;                                        color.green =255;                                        color.blue = 0;                                        boundingRectanglePath.strokeColor = color;                                         boundingRectanglePath.strokeWidth = 1;                                }

 

I would like to fine tune and make this independent.

Am printing the name and also drawing a green box for the file name which is found and hence the code.

 

Can somebody suggest me the easiest way of having embedd link name?

 

Regards,

Suneel


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>