Back

If your email is not recognized and you believe it should be, please contact us.

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Simple relink script help! #60788
    ivan_
    Member

    Ah right just looked up catch(err) am I correct in thinking it supresses any javascript errors?

    The script is running well, though I seem to have a slight glitch.

    Currently the indesign documents relinks embedded linked files to a new file location. The indesign document consists of two links to multi page pdf's with 4 instances each across the document (8 links in total).

    Some times the script runs and only two links remain embedded whilst another time the script may leave four links embedded. Is this something to do with a time out of the script? It seems to execute for several seconds then gives up re-linking.

    Would it be possible to add a function that loops the link.update(); until all links are re-linked?

    iv

    in reply to: Simple relink script help! #60787
    ivan_
    Member

    Thank you Kasyan, your help is greatly appreciated.

    The directory slashes seem to happen when copying and pasting from extendscript to the forum, it also seems to change the script 'i–'.

    Would it be possible to talk me through the script and its actions. This is as how I understand it:

    #target indesign = targets indesign application
    var i, link, newFile, = specifies variables


    doc = app.activeDocument, = specifies the active document as the file name
    links = doc.links, = name of all the links in the file
    newPath = “/c/temp/newproject/”; = new path string

    for (i = links.length-1; i >= 0; i–) { = loops through each link in links from 0 to infinity
    link = links[i]; = each link in the loop is a seperate string
    newFile = new File(newPath + link.name); =concatenates path and file name to create new file
    if (newFile.exists) link.relink(newFile); = loops throguh and relinks files
    try {
    link.update(); = update links
    }
    catch(err) {}
    }

    Was just wondering why you have to use 'try { }' and 'cath(err){}'.

    Regards,

    Iv

Viewing 2 posts - 1 through 2 (of 2 total)