Skip navigation
Currently Being Moderated

Illustrator How to relink images using the .replace() string method?

Oct 23, 2012 9:41 AM

Tags: #illustrator #cs5 #image #adobe #relink #placeditem #fpo #opi

I have a script using the dynamic content plugin from illustrator which takes and XML file and replaces it with a new one. All linked text/symbol/image links have their paths updated or text content updated.

 

The problem I have is I have background images which are not dynamic so I need to relink these based on their file path.

 

We have two shares, an OPI & an FPO, because of the size of backgrounf images we keep the FPO links in whilst artworking.

 

What I'd like to do is relink all images if they contain FPO in their file path, I'm in CS5.1. I had a look and found CS6 has a .relink method but obviosuly this is no use to me in CS5.1

 

Any ideas or starting points?

 

Thanks

 
Replies
  • Currently Being Moderated
    Oct 23, 2012 11:12 AM   in reply to thomas.f.elton

    use the file property of the placedItem or rasterItem if your images are embeded.

     

    placedItem.file = File("c:\yourFolder\yourImage.png");

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 23, 2012 2:20 PM   in reply to thomas.f.elton

    you got the idea, but no, it is not that easy, replace() is a method of the String Object, while the file property expects a File Object. In short File Object does not support the replace() method.

     

    you'll have loop thru your selection, get the path of the placedItem, apply your replace() method to this path to make a new path, make a new File Object out of this new string, apply to the file property.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points