• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

How to select all linked files via script

New Here ,
Oct 14, 2022 Oct 14, 2022

Copy link to clipboard

Copied

Does the script or action delete all linked files that are placed?

TOPICS
Scripting

Views

117

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 14, 2022 Oct 14, 2022

Copy link to clipboard

Copied

There are advertisements in the placed files, because there are a lot of such files to be processed, I want to delete all the placed files, is there a good way?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 14, 2022 Oct 14, 2022

Copy link to clipboard

Copied

do you know how to select them by hand? it's as easy as running a script

 

- open the Links panel

- select all links

- click on the Go To Link button

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 14, 2022 Oct 14, 2022

Copy link to clipboard

Copied

I know this, but, I have hundreds of files and it's too slow to do it manually!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 14, 2022 Oct 14, 2022

Copy link to clipboard

Copied

Use the script to select all the placed files, create an action to delete all the placed files with one click

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 14, 2022 Oct 14, 2022

Copy link to clipboard

Copied

edit the script that m1b wrote for you, instead of deleting a linked file by name, delete them all. Remove the condition that checks the name of the link

                if (
                    doc.placedItems[j].file.name == name
                    && ++count
                )

 

and if you don't want the alert (the popup window) remove this line as well

alert('Removed ' + count + ' placed items of "' + removeThis + '".')

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 15, 2022 Oct 15, 2022

Copy link to clipboard

Copied

I don't know anything about scripting languages, can you give me a complete code example

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 15, 2022 Oct 15, 2022

Copy link to clipboard

Copied

Hi @Brother Li, you could achieve this with a small modification of my answer to your other question.

 

Just change this line (in two places in script):

 

if (itemName == name) {

 

to this:

 

if (true) {

 

 

It will remove all placedItems and also rasterItems with link information.

- Mark

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 01, 2022 Nov 01, 2022

Copy link to clipboard

Copied

LATEST

hi @Brother Li 
try:


app.activeDocument.placedItems.removeAll();
app.activeDocument.rasterItems.removeAll();


works for me

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines