开发者

Folder of recovered files missing their names - How can I find the one I am looking for by the contents of the file?

I managed to accidentally delete a backup of files I had which I then later reco开发者_开发技巧vered. The recovery has lost the files names and location and I am left with about 3000+ .indd (Adobeb InDesign) files.

My problem is I am trying to find the .indd file that I was working on with out having to open each one manually to check.

I know some of the words that I had and I am wondering if I could maybe read the .indd file using a binary reader looking for one of the keywords...I could build it in c# or whatever

Anyone got any ideas?


If regular search does not work, try the built in scripting, of which you can use Javascript, Visual Basic Script, or AppleScript to code. I'm going with JS...

I'm no expert, but I found this code snippet from page 101 of InDesignCS5_ScriptingGuide_JS.pdf and modified it a bit:

var folder = new Folder("C:/Path/To/Files");
var files = folder.getFiles('*.indd');

for (var i=0; i<files.length; i++) {
    var file = files[i];  
    open(file):

    var myDocument = app.activeDocument;

    //Clear the find/change text preferences.
    app.findTextPreferences = NothingEnum.nothing;
    app.changeTextPreferences = NothingEnum.nothing;

    //Search the document for the string "Important Text".
    app.findTextPreferences.findWhat = "Important Text";

    //Set the find options.
    app.findChangeTextOptions.caseSensitive = false;
    app.findChangeTextOptions.includeFootnotes = true;
    app.findChangeTextOptions.includeHiddenLayers = true;
    app.findChangeTextOptions.includeLockedLayersForFind = true;
    app.findChangeTextOptions.includeLockedStoriesForFind = true;
    app.findChangeTextOptions.includeMasterPages = true;
    app.findChangeTextOptions.wholeWord = false;

    //Perform search
    var myFoundItems = myDocument.findText();
    if (myFoundItems.length) {
        alert("FOUND!");
        break;
    }

    app.findTextPreferences = NothingEnum.nothing;
    app.changeTextPreferences = NothingEnum.nothing;

    myDocument.close();
}

Don't quote me on that, I did not actually run the code, but that's the idea.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜