Skip to main content
Participating Frequently
February 23, 2017
Answered

Need help with a short Illustrator Script

  • February 23, 2017
  • 2 replies
  • 2474 views

Hello Illustrator Scripting Community,


I'm searching a long time for a solution with a short Illustrator Script. Maybe you can help me.

If you have any idea how to solve my problem via "actions" I would also bei very happy.


The following I need to do.

1. Open several Files each by each in Adobe Illustrator (this is also possible with actions)

2. Select all graphics inside of the file (this is also possible with actions)

3. via the Panel "Links" I need to use the function "embed picture(s)" (this is not working to record this part for an action)


My question ist now. Is there any other way to get "embed picture(s)" into any action recorded or do I need to have a Illustrator Scrip which solves the hole three steps for me? If so, is anybody able to write this script, because I have no idea of scripting in Illustrator.


Thank you very much for your help

best regards

Daniel

This topic has been closed for replies.
Correct answer o-marat

First version that needs more testing:

m_js_team / embedLinks / source / embedLinks.jsx — Bitbucket

2 replies

o-marat
Inspiring
February 23, 2017

This is the simple function to embedded all palced items in the active document:

embedRasters();

function embedRasters() {

  var d          = activeDocument;

  var rasters    = d.placedItems;

  var rastersLen = rasters.length;

  for (var i = rastersLen - 1; i >= 0; i--) {

    var raster = rasters;

    raster.embed();

  }

}

o-marat
Inspiring
February 23, 2017

Hi, info@danielberkmann.com​!

How many files you want to open at one launch of the script?

New  File after opening and taking actions immediately close, right? And open the next.

NewNew What to do with the file after make changes? Save in the same folder or save to another folder so the original is left unchanged? Or...?

Participating Frequently
February 23, 2017

Hey o-marat

thank you very much for your answer. The best case for me would be saving it in the same folder to overwrite the old file. And yes then open the next one, the next one, and so on.

At the moment I have 170 files who I like to run the script with, but there are coming more.

One at a time would be great, otherwise my Illustrator crashes, because some of the files are very complex.

Maybe with the script it is possible to select a folder and the script opens every file (one at a time) in this folder, embeds all Links, saves (overwrites) it and closes it.

Participating Frequently
February 25, 2017

Hi, Daniel!

The script doesn't select something directly.

And it should work even if all the objects are locked and/or hidden.

The error occurs always on random files or on some specific files?

Could you give me your files at which error occurs?

And what you Illustrator and OS version?

Thanks!


Hey o-marat,

yes the error occurs on random files.

I tried to open those files and changed something like if the layer is locked or which layer is selected, when I close the file.

Now that I changed those things at the "error files" everything is working with your script. These days I create some new files and I think then I get the error message again. If the error occurs with one of the new files I'll send you those.

Thanks for your answer and your help.

Daniel