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

Update Links

Advisor ,
Aug 14, 2013 Aug 14, 2013

I'd like to update the Links in a document, the moment they become in need of updating.

Ideally whilst InDesign is in the background and a [SAVE] action inside Illustrator causes this to update to be required.

However if that's not possible, then simply invoking the script by [Command + Tab] moving into InDesign... is that able to invoke a script?

If not... I'm guessing the fastest way to do things is still going to be manually with a shortcut assigned to Update Links... what I'm using now.

TOPICS
Scripting
4.0K
Translate
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
Valorous Hero ,
Aug 14, 2013 Aug 14, 2013

Here's a simple Update Modified Links script I use in my workflow.

It updates all modified links in the current document. Just assign a shortcut to it — no need to open Links panel to update links.

Translate
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
Advisor ,
Aug 15, 2013 Aug 15, 2013

if you want to get fancy and create a autoupdater, you can use AFTER_ATTRIBUTE_CHANGED event listener to look for a change in a link's status property.

http://jongware.mit.edu/idcs5/pc_Link.html#addEventListener

Translate
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
Advisor ,
Aug 15, 2013 Aug 15, 2013

Ok... I assume you two are talking about the Javascript that Indesign and Adobe use.  ExtendScript, I think it's called.

Firstly, it's probably important to understand... I'm trying NOT to goto Indesign.  SO I can keep working Illustrator, and see the updates live on the iPad. 

Rob Day has helped me get most of the way...  http://forums.adobe.com/message/5594570#5594570

Here's what I'm trying to do, I've marked my own comment "helpful", rather cheekily, so you can see what I'm doing, it's live previewng on the iPad (or as near is possible) from Illustrator to Indesign to the iPad.

Take a look at the following code, for an AppleScript effort inside Illustrator, that talks to Indesign from Illustrator, via the OS

tell application "Adobe Illustrator"

    tell document 1

        save

    end tell

end tell

tell application "Adobe InDesign CS6"

    tell active document

        delay 3

        update every link

        save

    end tell

end tell

That PARTIALLY works. 

Two problems

1. It doesn't seem to do a FULL update of the Links.  They're rendered by Indesign in the Proxy quarter resolution (the changes)  and the indicator for Link Update Needed still shows... but the content has actually changed.  However a full resolution doesn't happen without a manual update.

2. I can't find a way to make a keyboard shortcut for invoking this script.  So I have to goto the File>Script menu item everytime, which kind of is slower than the current sequence:

[Command + S] ... [Command + Tab] ... [Command + Option + A] ... [Command + Tab] .... continue working.

// btw my shortcut for update all links is [Command + Option + A]

Translate
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
Advisor ,
Aug 15, 2013 Aug 15, 2013

This could be easily done with idle task.

Turn auto update on:

#targetengine tomaxxiTEST

main ();

function main () {

    var

        uTask = app.idleTasks.add ( { name: "tomaxxiAUTOupdate", sleep: 1000 } ),

        uEvent = uTask.addEventListener ( IdleEvent.ON_IDLE, uUpdate, false );

   

    alert ( "Auto update modified links is ACTIVATED!" );

}

function uUpdate ( e ) {

    if ( app.activeDocument.links.everyItem ().status.toString ().indexOf ( "LINK_OUT_OF_DATE" ) != -1 )

        app.menuActions.itemByID ( 132633 ).invoke ();

}

Turn auto update off:

#targetengine tomaxxiTEST

main ();

function main () {

    if ( app.idleTasks.itemByName ( "tomaxxiAUTOupdate" ).isValid ) {

        app.idleTasks.itemByName ( "tomaxxiAUTOupdate" ).removeEventListener( IdleEvent.ON_IDLE, uUpdate, false );

        app.idleTasks.itemByName ( "tomaxxiAUTOupdate" ).remove ();

        alert ( "Auto update modified links is DEACTIVATED!" );

    } else {

        alert ( "Auto update modified links is NOT ACTIVE!" );

    }

}

This is just basic example. It could be extended way more.

Be aware that this will update ALL links in active document.

If you switch to another document, it will update all modified links as well.

Hope this will help you.

(How to Install a Script in InDesign That You Found in a Forum or Blog Post)

--

Marijan (tomaxxi)

http://tomaxxi.com

Translate
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
Advisor ,
Aug 15, 2013 Aug 15, 2013

Marijan, i think the onIdle doesn't fire (on windows, at least) if indesign is not the active (foreground) app.

Translate
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
Advisor ,
Aug 15, 2013 Aug 15, 2013

You think I would post this without testing?

It works just fine here on Win, and should on Mac as well!

Translate
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
Enthusiast ,
Aug 15, 2013 Aug 15, 2013

Hi,

I use onidle-Event for productionprogress-slideshow in a newsroom and while testing on my local machine I recognized that it works even if ID is not frontmost!!!

Translate
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
Advisor ,
Aug 15, 2013 Aug 15, 2013

Ok, let's get the stupid stuff (me) out of the way first.

Marijan that might look simple to you... but there's a world of prerequired knowledge I don't have.

See how I go here:

1. This looks like your making a script to run INSIDE Indesign, right?

// I ask because there's apparently 3 ways to do this: a) script in Ilustrator, b) OS X script, c) script in InDesign

2. You're taking advantage of InDesign acknowledging, to its self, that it's in an idle state, and then making it check for updates necessary, then performing those updates, then sleeping the script for 1000 time units, right?

Next, stuff I have no contextual knowledge of:

What is tomaxxiTest, tomaxxiAUTOupdate and uUpdate?

Want a super stupid question?

Why does function main() exist inside main() ... and how is that even possible?

By now you probably realise I know very little (right next to nothing) about scripting in Adobe products)

Which it looks like you tried to help with... with that link.  But that link is linked to anything other than http://

Marijan, I can't thank you enough for pointing your (clearly) brilliant programming mind at this.  But I'm a very horrid student.  I have none of the pre-requisite knowledge.

//one other thing... why do you put spaces after function names and before the brackets ( ) like that all the time?  It's confusing an already befuddled brain

Translate
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
Advisor ,
Aug 15, 2013 Aug 15, 2013

1. This looks like your making a script to run INSIDE Indesign, right?

Yes, exactly.

2. You're taking advantage of InDesign acknowledging, to its self, that it's in an idle state, and then making it check for updates necessary, then performing those updates, then sleeping the script for 1000 time units, right?

Yes, that's right. Time interval is in milliseconds, so 1000 is equivalent to 1 sec. I've noticed some issues when using small update times, so feel free to increase it.

What is tomaxxiTest, tomaxxiAUTOupdate and uUpdate?

- tomaxxiTest is scripting engine under which the script is run

- tomaxxiAUTOupdate is just a idleTask name for easier reference

- uUpdate is function which is called to execute the update

Why does function main() exist inside main() ... and how is that even possible?

It doesn't. main(); is a call for function.

Which it looks like you tried to help with... with that link.  But that link is linked to anything other than http://

That link explains how to save and execute scripts.

one other thing... why do you put spaces after function names and before the brackets ( ) like that all the time?  It's confusing an already befuddled brain.

It's just a habit.

I've updated first script a bit, so if you are using the old version, update it to this.

(added: checking for existing idle task, check for opened documents)

#targetengine tomaxxiTEST

main ();

function main () {

    if ( app.idleTasks.itemByName ( "tomaxxiAUTOupdate" ).isValid )

        alert ( "Auto update modified links already ACTIVATED!" );

    else {

        var

            uTask = app.idleTasks.add ( { name: "tomaxxiAUTOupdate", sleep: 3000 } ),

            uEvent = uTask.addEventListener ( IdleEvent.ON_IDLE, uUpdate );

        alert ( "Auto update modified links is ACTIVATED!" );

    }

}

function uUpdate ( e ) {

    if ( app.documents.length > 0 ) {

        if ( app.activeDocument.links.everyItem ().status.toString ().indexOf ( "LINK_OUT_OF_DATE" ) > -1 )

            app.menuActions.itemByID ( 132633 ).invoke ();

    } else {

        app.idleTasks.itemByName ( "tomaxxiAUTOupdate" ).removeEventListener( IdleEvent.ON_IDLE, uUpdate, false );

        app.idleTasks.itemByName ( "tomaxxiAUTOupdate" ).remove ();

    }

}

--

Marijan (tomaxxi)

http://tomaxxi.com

Translate
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
Advisor ,
Aug 15, 2013 Aug 15, 2013

Marijan, the link on installing scripts you posted does not work

Translate
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
Advisor ,
Aug 15, 2013 Aug 15, 2013
LATEST
Translate
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