Indd - JS: Searching an image in subfolders and relinking

Hi,
Can any one help me....
In an Indesign Document I want to relink all the images to a new path.
Please see the below script, it search for the images in a specified path only. But i want to search the images in a particular directory along with its sub-folder too.
var myFolder = Folder.selectDialog("Select Folder for Images");
var new_path = myFolder+ '/'
imgs = app.activeDocument.allGraphics
for (i = 0; i < imgs.length; i++)
img = imgs[i].itemLink
myFile = File (new_path + img.name);
if (myFile.exists) {
img.relink (File (new_path + img.name))
img.update()
Thanks in advance,
Bharathi Raja G.

Hi Shanto,
You can download a script for updating path names in links: http://www.businessweekly.h.com.ua/relink.html
You select a folder, and, for every image in the active document, it searches for the file that has the same name as the old one, and if it's found, relinks it.
If the file with the exact name is not found, the script tries to find a file with the same base name but a different extension (".psd", ".tif", ".jpg", ".ai", ".eps", ".pdf", ".indd").
If the script doesn't find the new file in the chosen folder, it repeats the above-mentioned process for every subfolder.
But this script was written for CS2/CS3 and I have doubt that it would work in CS. I can’t check this as I don’t have CS any more.
To all appearance, Indesign files, you received, were created on Mac, but you are on PC. I remember this problem in CS – it has been corrected since CS2.
In such cases I use the following workaround:
1.Copy Indesign file to the folder where links located.
2.Open it, Indesign should find all lost links in this folder and its subfolders.
3.Save and close the document.
4.Copy/move the Indesign file to its original location.
Kasyan

Similar Messages

  • Linking images in subfolders

    Does anyone have a script to scan subfolders and relink images. Scenario - InDesign file contains numerous images that have been moved to various subfolders in a new server. The main path I can change, but I need to scan the subfolders and relink the inline images. I can do this manually but the number of files and images is very large, a script would be better.
    Thank you,
    Terri Pagån

    Nevermind this was answered a few entries down.  Thanks!

  • Script to search and relink linked image files that were moved?

    Good afternoon
    My indesign product catalog has links with a lot of different folders around in my hard disk, not a single folder. And to keep my catalog up to date I must package it.
    When I move my linked files in my computer because I change the folder structure or do some cleaning, my indd loses track of its linked files. Currently I need to relink one by one.
    Therefore I would like to find a script which would scan the hard disk with the all broken links in mind to detect their new location and relink. Yes I am a lazy person.
    Thanks for any clue,

    Thanks so much! I will try soonest.
    How does your script react in the unlikely case of duplicates?
    Date: Thu, 18 Jun 2009 12:43:47 -0600
    From: [email protected]
    To: [email protected]
    Subject: Script to search and relink linked image files that were moved?
    At least your honest about your laziness.... Here's your reward:
    Just a hint, don't select root of your volume, it will loop through every folder in existence, but key to this script is, if you know the general location, select into that folder hierarchy and the script will test for a relative path, otherwise, come back in a few days, and it will be finished.
    ~mike
    var processed = 0
    var skipped = 0
    var updated = 0
    if (app.documents.length > 0){
        if(app.activeDocument.links.length > 0){
            var mydoc = app.activeDocument;
            var mylinks = mydoc.links;
            var myRoot = Folder.selectDialog("Choose the volume or server where assets are located", undefined, false);
            main();
    else
    { alert("No Links present")
    else{alert("No Documents Open")
    function main(){
        if(myRoot != null){
            for(var i = 0; i < mylinks.length ; i++){
                if(mylinks.item(i).status == LinkStatus.linkMissing){
                        var linkdata= mylinks.item(i).filePath;
                        var my_result = linkRepair(linkdata);
                            if (my_result == false){
                                var filetype = "." + mylinks.item(i).linkType;
                                var mysearch =   search(linkdata, filetype);
                                    if(mysearch != undefined){
    var myswitch = confirm(mylinks.item(i).name + " has been found in a different location, Relink and Update?", "Relinker")
                                            if(myswitch){
                                                mylinks.item(i).relink(File(mysearch));
                                                mylinks.item(i).update();
                                else{
                                    alert("" + mylinks.item(i).name " was not found\nFolders processed: "processed + "\nFiles skipped: "+ skipped)
                            else{ alert( my_result + " has been found");
                                mylinks.item(i).relink(File(my_result));
    function linkRepair(linkdata){
    var mypath = linkdata.split(":")
            my_status = analyzePath(mypath)
            if(my_status == true){alert("UPDATED");
                    updated++       
        return my_status
    function analyzePath(mypath){
    var num = mypath.length ;
    for(var i = 0; i < num-1; i++){
        mypath.shift()
        var newpath = pathRebuild(mypath)
        newpath = (myRoot + newpath)
            if(File(newpath).exists){
                return newpath
        return false
    function pathRebuild(pathArray){
    var solidPath = ""
        for(var i = 0; i < pathArray.length ; i++){
            solidPath +=  "/" + pathArray+ ;
        return solidPath;
    function search(linkdata, filetype){
        var mypath = linkdata.split(":")
        var mylink = mypath.pop();
        var OK = confirm("Relative Path does not exist, search folder hiearchy for file?", true, "File Scanner")
        if(OK){
    var myscanresult = getfiles(mylink, myRoot)
    return myscanresult
    function getfiles(mylink, myBase){
    myBase = Folder(myBase);
    var files = myBase.getFiles("*")
    for(var i = 0; i < files.length; i++){
    try{
    var foldertest = files+.getFiles();
    processed++
    var myfile =     File(files+ + "/" + mylink)
        if(myfile.exists == true){
            return myfile
            break;
        else{
        var myscan = getfiles(mylink, Folder(files+))    
            if(myscan != undefined){
            return myscan
            break;
    catch(myerror){
        skipped++
    >

  • Need advice. Is it necessary to put images in folders and subfolders with LR?

    It seems that the concept of spending hours putting files into folders, sub-folders and sub-sub-folders is not needed  with LR. Creating all these folders takes hours, especially if you are like me and need a major reorganization of image organization. My thought is that all images can go into one massive folder as long as they are properly tagged. I can then use LR Smart Collections to essentially virtually organize all my images. I can create many more sorting options using Smart Collections than I can by putting images into a folder. This flies in the face of everything I've learned about storing data on a computer so I'm nervouse to head this direction because it starts with unorganizing my folders and removing all tags so I can start fresh.
    I don't want to take this on only to learn I didn't think of a gotcha issue. One drawback is that you are now committed to find anything by using LR or tags only. What do you think?

    Lee Jay wrote:
    Okay, then be honest.  What would you do if you were me?....So - give me an honest recommendation on a go-forward path (no "coulda, woulda, shoulda's").
    Honestly, I always start off from assessing what you really need or what value you could get from keywording. I wouldn't advise you to add keywords for their own sake.
    Lee Jay wrote:
    Meanwhile, I can already find all my images efficiently in seconds in nearly all cases.  I estimate that there is about one situation per year where having a comprehensively keyworded image store would be helpful in saving me time - perhaps 15 minutes each time that happens.
    Let's pretend that this isn't quite as black and white as you always put it. Let's say we're mainly talking weddings - typically wedding photographers add few keywords, if any. And let's say you do need to find certain images more often - each time you go to meet prospective clients you want to put on your iPad (you?) a portfolio of your best work for their broad type of wedding. So you might have categories like indoors / outdoors / subaqua, particular venues, age groups, religions through humanist,  formal / weird. Let's assume you do judge it worthwhile to increase the number of keywords.
    Lee Jay wrote:
    I could start tagging images now as I collect them.  But then I'd have all those other images that aren't tagged and all the new ones that are.  That means using the smart-collection approach would mean all the new ones were in neat collections, and all the old ones were in a gigantic "untagged" collection with over 100,000 images in it.
    Actually, that is the way I would advise you to go. Don't let the perfect be the enemy of the possible. It's not at all uncommon that people are put off beginning doing some keywording by the scale of the complete task. But beginning with the images that you're currently working on isn't too much extra effort. Even if it turns out that you never eventually do go back and keyword the old stuff, in a year's time you'll have a whole year's worth tagged. While doing so you'll probably adopt ways to make keywording less of a chore. For example you might add metadata presets to slap on overall keywords for the typical shoot "Wedding, Ceremonies, Christian" and then one or more keyword sets if you can justify putting time into varying the keywords between images - eg Bride, Kids, Cake. I wouldn't waste any time building up a hierarchy (do if you want, or not if you don't).
    I simply wouldn't worry about the 100,000 remaining untagged - they'll be easier to tackle once you're you've got the experience / benefits from keywording new stuff. I'd advise you to do it only as and when you need - it's too big a task to do anything else. Let's say you need your best shots of Jewish weddings and - as you're currently keeping a lot of metadata in your head - you know some are in that untagged mass. Find them through the folder system as you do now, whack on some keywords like "Wedding, Jewish, Non-orthodox". All those shots are of the bride - whack on "Bride" (maybe from a keyword set). Hey, she's got an obvious tattoo - let's just add that keyword just in case it'll be useful. And quickly move on. Whatever seems worthwhile.
    Although scripting could help, where's the script? Worthwhile to write/adapt one yourself? Instead for folder names I'd just just smart collections to gather image - eg folder name contains "weddings" - and then slap on the keywords. Sure, there will be some duplication between the pseudo-metadata in the folder names and in keywords, but duplication happens with metadata. In fact, it'll be quicker to search by the keyword "Wedding" than search for images with the keyword "Wedding" and / or with the folder name containing "Wedding".
    So that's how I'd advise you - start with the new work, and deal with the older stuff ad hoc.
    John

  • Firefox upon opening an image in a new tab, centers the image from top and bottom and surrounds the image with a grey frame. Just started having the problem today, searched Google to no avail.

    Firefox upon opening an image in a new tab, centers the image from top and bottom and surrounds the image with a grey frame. Just started having the problem today, searched Google to no avail.

    Oh wow, looks like a new feature.
    The "page" links in a stylesheet with the address "resource://gre/res/TopLevelImageDocument.css". If you remove that reference, then the image displays in the old style.
    '''''Edit: Please skip the rest of this post and check out the next one.'''''
    There might be a more elegant solution than that, but you could use a bookmarklet to strip out that link when you want to view the page in its old style. A bookmarklet is a snippet of JavaScript you save on the Bookmarks toolbar for quick access.
    First, copy the following code to the clipboard (it's all one long line):
    <br>javascript:var ssheet=document.querySelector('link[href="resource://gre/res/TopLevelImageDocument.css"]'); if(ssheet)ssheet.parentNode.removeChild(ssheet); void 0;
    Next, if you are not displaying the Bookmarks Toolbar, use View > Toolbars > Bookmarks Toolbar to display it. (If you aren't using the classic Menu bar, press Alt+v to call up the old View menu. Right-clicking the gray area just below the page address also allows you to display the Bookmarks Toolbar.)
    Right-click on the Bookmarks Toolbar (or Mac equivalent of right-click!) and choose New Bookmark.
    Paste the code into the Location box (the second box).
    Then type a useful name in the Name box (e.g., Oldstyle Picture) and click Add.
    Now, when you want to tweak the image display, click the button to run the script.
    Manual clicking is a hassle, so it might make sense to look into other solutions. (Greasemonkey didn't seem to work; I think it might not run on .jpg files.)

  • Firefox 5 Searching for images on the web is much slower than opera and my previous Firefox version. Can I turn off the useless zoom thing when I hover over an image for a few seconds?

    OK, what I want to do is search for images with Google or similar search engine. This was fine in my previous FF version. The images just loaded as thumbnails, all the same size and I had to click on one to open it in a new tab or whatever I wanted to do. Now the images load all different sizes and if I hover for a moment over on, it zooms in a bit and gives me some image details. This slows image searching to the point of being very frustrating. I thought this might be a Google things, so tried other search engines. Tried switching Javascript off to speed things up, just blank grey rectangles displayed. Tried Opera and it loads basic images like Firefox used to, FAST...

    The speed of image searching isn't a problem for me. The trouble is, the automatic zoom function is lightning fast and I find it disturbing to the point that it makes me feel very ill.
    I very much want a way of suppressing it.

  • Can I export by year and drop images into subfolders by month?

    I'm somewhat new to Lightroom, coming over from Aperture.
    Is there a way to export all of my catalogue files by Year>Month.  There are about 3 years worth of images there.
    So the top folder would be Year (the year the image was created) and inside that folder would be 12 folders, one for each month.  This is something I do in Aperture at the end of the year, before archiving my images.
    Thanks for any assistance you can provide.

    Try making a direct shortcut to the Organizer and then the Editor.
    You should then be able to drag and drop on to the desktop icon.
    On Windows right click on the desktop and select New >> Shortcut
    Browse to Computer OS C:
    And find the PSE Organizer application in Program Files or Program Files (x86) on Windows 7 - 64 bit.
    Inside the Adobe >> Photoshop Elements Organizer (yellow folder) you are looking for an application file “PhotoshopEementsOrganizer” with six small icons (e.g. representing thumbnails - could be different in PSE5 but look for the exe file)
    Select it and click OK
    Click next
    Rename by taking out Photoshop Elements leaving just the word Organizer
    Then click finish
    You should now be able to launch directly form the desktop by double clicking on the icon.
    You can set up a similar direct link to the Editor application.
     

  • Suddenly, My Safari 5 doesn't auto-complete at the same time "Search By Image" became useless . .

    Since assigning where to post questions amongst the communities here as gotten more complicated, I've had a few questions go unanswered . .  unlike in the past . . .
    But I'll give it another shot with this one :
    A few days after Google brought back the black bar for "search, images, maps" etc., I tried to use my Bookmarked "Search By Image", which always started a series of drop-downs and led to choosing the image, and then working just peachy.
    Now there's a grey-box to the right of the Google search-bar which does absolutely nothing !
    Where to I indicate or paste the image now ??
    The same day, entering in a regular Google search brings up no suggestions 2 or 3 letters in . .  or at no point till typing is complete and 'search' is clicked.
    And now ?? . . . even coming here was snafooed by "Jive has detected Internet Explorer 6" ?!?
    Retrying a moment later got me here, where a new line entered is suddenly being placed a paragraph above where I'm typing !
    Seems like a whole bunch of goofy goin' on all of a sudden, no ?
    I really just want help with the 1st 2 bug-a-boos, but the whole conga-line of weirdness has me wondering if we're getting hacked all over !
    or what !
    I'm on Safari Version 5.1.10 (6534.59.10)
    OS 10.6.8

    Hi ...
    In case you are not aware, Apple no longer updates Safari for Snow Leopard >  Apple Kills Snow Leopard: OS X 10.6 No Longer Receives Security Updates
    Thus your Mac does not provide anymore security updates for Snow Leopard.
    You may want to consider upgrading to a newer OS X if your Mac qualifies.
    As for the Google issue ... try emptying the cache and deleting cookies.
    From your Safari menu bar click Safari > Empty Cache
    Back to the menu bar click Safari > Reset Safari
    Select the following:
    Remove all website data
    and Clear History
    Click Reset.
    Then quit and relaunch Safari to test.

  • Inserting image to jFrame and save it in a sql database

    Hai guys, I have a problem in inseting a image in jfame and save it in database (my sql)
    does any one have an idea about this task reply me pls
    thanks
    bay !

    Use BLOB (Binary Large Object) to save your image to a database.
    As far as displaying a image on Jframe, search the forum.

  • Afte mirgation from SP 2010 to 2013, change the search box image size in sharepoint 2013

    Hi,
    After migration from 2010 to 2013, the search box image size increased. Pls check the screenhot below,
    I
    i need to resize this searc image.
    Any help is much appreciated.
    Thanks
    Smile Always

    I assume you have made some changes to this out of box search 
    you will have to take help from a CSS expert to select the div of this image and resize it. it has to be updated in css file on the server
    You can use developer(f12) tool in IE to test that 

  • When I do Google search for images from my website nothing newer than September 2012 shows up.  How can I get Google to find new images?

    When I do Google search for images from my website nothing newer than September 2012 shows up.  How can I get Google to find new images?

    Have you uploaded a sitemap.xml recently and checked your webmasters account to see when your site was last crawled?
    http://www.iwebformusicians.com/Search-Engine-Optimization/SEO.html

  • MDM: Search for images in the dialog window "Select Multiple Images"

    Hi,
    are there possibilities to search for images in the dialog window "Select Multiple Images" (if you want to add a image to a record)?
    I know the possibilities to sort the images and the possibilities with the data groups. But I don't know a possibilities to search for a single image.
    Thanks for any help!
    Best regards, Melanie

    Hi,
          From the question you asked; its not much clear what your clear requirement is; but if its what i get then the solution is:
          How is that you want to select the image? With Image view or By viewing the image itself ? For it when u select "Select Multiple Images" you can find two as "Available Images" and "Selected Images" and in between u can find some buttons, after "All, Add, Remove and None" you can find two buttons "Thumb Nail" and "view Details". I think you can use these buttons for your solution.
          When you select "Thumb Nail" button you can see the image in real and select the image.  OR you can select "View Details" and check the file name or path or the requirement as required.
          CHARAN
    Lead, follow or Get out of way

  • Images, Thumbnails, byte[ ] and BLOB

    Hi guys,
    This is what I have to do:
    User selects image from disk and i'm putting it into DB (IBM DB2 8.0). That's clear. No problem.
    But I need that image as a thumbnail as well (I have to show images as thumbnails for each Item). I have a DB table IMAGE with 2 columns - IMAGE_FULL and IMAGE_THUMBNAIL.
    So I need to scale image(wich I have as byte array, or struts FormFile) and than put it into DB as Thumbnail.
    Or even if I don't have IMAGE_THUMBNAIL column, I have to get image as byte array from IMAGE_FULL column, scale it and show it in the browser.
    So, if I explained correctly and not very complicated way, can anyone give some ideas?
    Thanks in advance
    Gio

    For thumbnails, there's plenty of examples of resizing and saving images in the Java Programming forum, just do a search.
    For the database storage and retrieval... I had found some really good site with database examples, but I can't find it anymore.... but here's some code:
    // store
                   PreparedStatement pstmt = db.getConnection().prepareStatement(
                        "INSERT INTO TeeColor VALUES( ?, ? )" );
                   pstmt.setString(1, "yellow");
                   File fImage = new File("yellow.gif");
                   InputStream isImage = new FileInputStream(fImage);
                   pstmt.setBinaryStream(2, isImage, (int)fImage.length());
                   int res = pstmt.executeUpdate();
    // load
                   Statement stmt = db.getConnection().createStatement();
                   ResultSet rs = stmt.executeQuery(
                        "SELECT TCBlob FROM TeeColor WHERE TColor = 'Yellow'");
                   if(rs.next()) {
                        byte[] bytes = rs.getBytes("TCBlob");
                        JFrame f = new JFrame("test");
                        f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                        f.getContentPane().add(new JLabel(new ImageIcon(bytes)));
                        f.pack();
                        f.show();
                   }

  • Select images using keywords and view slideshow...using what?

    I have a library full of jpeg images that were created either using the export command from LR or by editing in Br/Ps and then savedAs jpeg. Now I want to watch slideshows on my monitor (30" Apple HD Cinema Display). Now I have the following Dilemma:
    - I can start a Search Command in Bridge and narrow it down to exactly the images I want in my slide show. Then from the View menu select Slideshow. The IQ is terrible. True sharpness is only revealed when zooming in 100% but that's not the idea of a slide show.
    - I can also use Apple OS's (Tiger) built-in slide show and start it from the finder. That way I get high quality, fast dissolving slide shows, that are unfortunately limited to the first 100 images in the Finder view. However, in the Finder I cannot select my images using keywords and IPTC info.
    So could there be a simple solution to the problems I'm running into with Bridge?
    Or could there be a nice viewer for MacOS that features the search option I want and renders good images and dissolve option?
    Thanks.

    @Ann Shelbourne: Thanks for your reply. I'm hesitant to upgrade to CS4 at this point. That would mean my only option is to look for a jpeg viewer other than Adobe that can select images based on keywords and iptc data. Would you know one that does?
    @Ramon G Castaneda: I apologise for being an inexperienced forum visitor. I will take note of your advice and follow the posting instructions.
    I checked FAQ's both here and at Adobe, as well as the knowledge base. No results. I also searched the forum.
    My setup: MPB dual core Intel, 2GB RAM, 30GB free disk space. Adobe CS3, just updated to Bridge version 2.1.1.9. No improvement at all so far. According to Ann only CS4 will solve the problem.
    Thank you.

  • A script to batch rename and relink images?

    Hello, everyone!
    First of all, I did search for this before asking and found many similar scripts for this, but as I don't know how to make or edit scripts, I couldn't use them...
    I work at a company that makes school books. Each InDesign file we make can have hundreds of images, of varied extensions (.ai, .eps, .tif, .psd).
    We now need to rename those images to a default naming system we defined. This is taking hours, even days to do manually.
    Those images currently have varied names, so we'd need to ignore what's there, we just need a configurable prefix (like "EF6_ESP_C1_"), then a 4-digit number starting at 0001 and numbering the rest (if there's say a .tif and then a .ai, it'd have to be 0001.tif and 0002.ai), then the extension it already had.
    Preferably, but not required, if it could read that the image already had an "EQ" in the file name, it could rename them to another prefix and count those separately from 0001, as we work Equation images separately, but if this can't be done or is too difficult to do, then just have them named and numbered with the others.
    Could anyone be so kind as to help me with this? Thank you very much!

    Try this,
    var doc = app.activeDocument,
        links = doc.allGraphics, count = 1, eqcount = 1, a = "0000";
    for(var i=links.length-1;i>=0;i--)
            if(links[i].itemLink.name.match(/^EQ.+/))
                    var ext = links[i].itemLink.name.substr(links[i].itemLink.name.lastIndexOf(".")),
                        old = File(links[i].itemLink.filePath),
                        eqnum = (eqcount++).toString(),
                        newname = "EQ_EF6_ESP_C1_" + a.substring(0, a.length - eqnum.length) + eqnum + ext;
                    old.rename(newname);
                    links[i].itemLink.relink(File(old.toString().replace(links[i].itemLink.name,newname)))
            else
                    var ext = links[i].itemLink.name.substr(links[i].itemLink.name.lastIndexOf(".")),
                        old = File(links[i].itemLink.filePath),
                        num = (count++).toString(),
                        newname = "EF6_ESP_C1_" + a.substring(0, a.length - num.length) + num + ext
                    old.rename(newname);
                    links[i].itemLink.relink(File(old.toString().replace(links[i].itemLink.name,newname)))
    Please note:It is not reversible.
    Regards,
    Chinna

Maybe you are looking for

  • Smart folders not working...

    I've got some smart folders that just stopped working... I haven't changed the definitions and they were working fine, but all of a sudden they are not. The one that is not working is defined with 3 things, one of them is another smart filter. This h

  • Updating required fields before submit

    Hi all! There's a form containing selectOneChoice component with required set to true. There are regular submit button and a button with immidiate and autosubmit both set to true. I expect the second button to update form fields, avoiding validation

  • I am unable to ubdate itunes to itunes 8

    I am trying to update to itunes 8 on windows xp but every time I get into the installation a notice pops up that says "The older version of apple software update cannot be removed. Contact your technical support group." I have removed the older softw

  • Qsig configuration on a gateway router

    Am trying to have billing working on my PABX. Does anyone know how to set the serial interface Qsig specification) to NPI = PRIVATE instead of UNKNOWN.

  • RoboHelp 7 - SLOW

    My company just upgrade to RoboHelp 7 last week and everything I do with the tool is extremely slow. Just getting it to launch takes forever. Any ideas?