Find text in a document

Is there a feature in Pages for the iPad where I can search for text within a long document. For example this would be ctrl F in Word.

I'm still a little new here what is Spanner?

Similar Messages

  • Is there a way to find text within InDesign documents in a search using windows environment?

    We are working in Windows and transitioning from using Word to InDesign for our documents.  InDesign documents do not show up in the results when trying to search for a file name or file contents. How can we search for specific text within our InDesign documents?  Any suggestions would be greatly appreciated.

    http://markzware.com/products/pagezephyr-search/

  • How to find text or paragraph by giving style name?

    Hello,
    can any body tell me,How to find text or paragraph by giving style name?actully i have so many styles which is applied on document.
    i want to find text in the document which have particular style name.is any method to find text by giving name of style?

    Any of the various findText methods, plus your paragraph style name in FindTextPreferences: http://jongware.mit.edu/idcs5js/pc_FindTextPreference.html
    Use Google to locate exact samples, as this has been done countless times before.

  • HT2506 In pages how can I link text within the document? I can find a bookmark option and links only allows me to link to a web page

    Hi all,
    This is my first time using this discussion site! Any help would be great, as I am getting very frustrated with pages!
    What I am trying to do is link text at the bottom of a document to a page at the beginning of the document. I can't find a bookmark option adn when I clink insert link it only provides an options to link to a web page. Help! thanks

    Bookmarks are missing (sadly) and with them, the ability to create an in document link.
    I was looking for this feature in a Table of Contents. When you assign a 'style' to text in a document, you can Insert > Table of Contents. Then Pages will keep the TOC updated and you'll be able to 'link' from the page number in the TOC. (Not much help though, for the OP)

  • Tcode FV50: How to find long text in FI Document line item Before Saving.

    Hi,
    How to find long text in FI Document line item.
    During Parking of the FI document through Tcode FV50 i m giving the some text in the long text not in the text field.
    I would like to validate the Long Text Before Saving in user exit "U300" under  the  "Sunstitution" .
    Please anybody can be help me out where exactly this long text is going to be stored or in which internal table or memory id.
    Please give me the answer as soon as possible .
    Note:- Read_Text function module is not useful. Because Read_text useful after saving document.

    Hi Amit,
    In application area FINANCIAL ACCOUNTING , go for node LINE ITEM. Here create a step & maintain the prerequisite as per your requirement & in the check you can mention the code or you can direct it to a custom program like ZFI_RGGBR000.
    Here while maintaining the check you will get structures BKPF & BSEG in which you will get the desired field you are looking for.
    Just try to explore in your system how the other validations are maintained.
    After you are done with all your code, you have to run the regeneration program RGUGBR00.
    Here utmost care should be taken while running regeneration program, you should select all the checkboxes in the selection screen except  GENERATE SETS, GEN SUBSTN ROUTNS IN ALL CLNTS  & TRACE PROG. GENERATE CALLS .
    Hope this make your doubt clear.
    Regards
    Abhii

  • EBS - Auto posting not working  if text behind the document number

    Hi,
    When the document number is at the end of the payment reference, there is no problem.
        However, when there is text behind the document number, the posting rule doesn't work anymore.
        The autoposting also fails when there is a seperator (like a comma) directly added to the document number.
    -   In the posting rule for invoice numbers (BE51), it is able to find multiple invoice numbers and clear these together.
        We were expecting this posting rule will behave the same, so when a customer mentions more than 1 document number,
        it is able to find them all and clear if they fulfill the criteria (total amount of the documents matches the amount received).
        But because of 1st mentioned problem, system doesn't clear anything because of additional text present.
    I am look help to solve this issue
    Thanks.
    With regards,
    V.K
    Best regards,

    Hi,
    Any input for above issue?
    With regards,
    V.K

  • Find to end of document or story

    Is there a way to limit the find text so that it only goes to the end of the document or story?
    When the cursor is planted in text the find dialog has a "To End of Story" option but I don't see any thing equivalent in the scripting. Of course, finding this stuff hasn't been by InDesign scripting forte.
    Thanks,
    Ken

    Olav Kvern wrote:
    main() 
    on main() 
    tell application "Adobe InDesign CS4" 
    if (count documents) is not equal to 0 then 
    set mySelection to selection 
    if (count mySelection) is 1 then 
    if class of item 1 of selection is insertion point then 
    my myFindChangeToEndOfStory() 
    end if 
    end if 
    end if 
    end tell 
    end main 
    You know, e e cummings had nothing on you.
    This is poetry, really.
    It's maybe being a little overly picky about when it's going to do its thing, but in such a charming way. Reminds me of 
    http://www.dailymotion.com/video/x1p48e_emily-loizeauhommage-a-j-prevert_creation (translation at 
    http://olisipus.blogspot.com/2006/11/pour-faire-le-portrait-dun-oiseau.html).
    on myFindChangeToEndOfStory() 
    tell application "Adobe InDesign CS4" 
    --Clear find/change preferences 
    set find text preferences to nothing 
    set change text preferences to nothing 
    set find what of find text preferences to ".  " 
    set change to of change text preferences to ". " 
    Or:
    set findText to text returned of (display dialog "Find what:" ¬
    buttons {"Cancel", "OK"} default button 2 default answer "")
    set changeText to text returned of (display dialog "Change to:" ¬
    buttons {"Cancel", "OK"} default button 2 default answer "")
    set find what of find text preferences to findText
    set change to of change text preferences to changeText
    You don't know of a way to have the cursor come up in the first dialog if this is run from Script Editor, do you? It doesn't matter since if I used this it would probably only be via the scripts palette, but I'm curious anyway.
    set myStory to parent story of item 1 of selection 
    set myIndex to index of item 1 of selection 
    --Here's how you'd select it: 
    --select text 1 of text from insertion point myIndex to insertion point -1 of myStory
    If you really wanted to but you don't. Okay.
    --do a find/change 
    tell text 1 of text from insertion point myIndex to insertion point -1 of myStory
    I see what you're doing, but I don't understand text 1 of text. Is there a text 0, -1, -2 of text?
    change text 
    end tell 
    --Clear find/change preferences 
    set find text preferences to nothing 
    set change text preferences to nothing 
    end tell 
    end myFindChangeToEndOfStory
    And they all lived happily forever after.
    One thing with AppleScript--because AppleScript assigns a *string* to the variable myText when you do something like this: 
    set myText to text 1 of text from insertion point myIndex to insertion point -1 of myStory
    I was going to ask what text was if not a string, but I guess I can put that up in the Script Editor result pane and see for myself.... Hmm, text 1 of text and text yield identical results, and it works with simply text as well. So why "text 1" of text, aside from what is it?
    ...you often need to use an object reference: 
    set myText to object reference of text 1 of text from insertion point myIndex to insertion point -1 of myStory 
    The above example gets around this by not assigning the text to a variable. 
    Yeah. The next time something doesn't work, I'm going to add "object reference of". If that doesn't work, I'll add "of parent story".
    re: PageMaker scripting 
    Let's be honest: It was awful. I loved it, because it was better than nothing, but it was fragile and incredibly limited.
    I think maybe I just used it different than other people, to get simple things I could trigger easily (using QuicKeys) rather than doing more complex things of the type you found it inadequate for. I believe you, really.
    CS2 doesn't have GREP, so charles darwin can't use that.
    I think he'll have to evolve, then.
    CS4 has GREP nested styles. You'll dig them.
    You said it, daddy-o. I'll check out the scene.
    While I'm the first to admit that the InDesign scripting documentation is not perfect, I have to point out--as gently as I can--that many of the problems you're having have to do with your knowledge of AppleScript, not InDesign scripting per se. 
    Or my bad memory, or my denseness. I read the Danny Goodman AppleScript book, Tom Trinko's (gigantic)
    Applied Mac Scripting,
    The Tao of AppleScript,
    Leer Jezelf Makkelijk AppleScript (in Dutch), Apple and Adobe PDFs, and I don't know what. But I never used most of what I read, and so forgot it.
    The FindText.applescript tutorial script goes over the basics of finding text in InDesign, and FindChangeText.applescript shows how to change text. While they can't cover every possible combination of find/change attributes, I think they do their job. Let me know if that's not the case! 
    I only looked at what was in the Scripting Guide, which did seem inadequate for some of the things I wanted to do in the scripts I recently did. If there was more in the samples, then I should have paid attention to them. If I have a look and find something missing there too, I will let you know.
    re: tool selection 
    InDesign scripting doesn't really deal with user interface interactions--it's not really designed that way. In PageMaker scripting, you *had* to select tools, because the script was running the user interface. In InDesign, scripts don't do anything with the user interface--they work on the object model directly. 
    Okay, but I haven't wanted or needed to script a tool change myself. Like I said, I did it in PageMaker basically only because that was the only way to do it with keycodes.
    This means that a script won't fail if/when the window view changes, when the selection state isn't what you expect, etc. (all of the things that made PageMaker scripting so fragile). 
    Aha, now we understand your e e cummings paranoia. :-)
    If you'd like, we could take a shot at converting some of your PageMaker scripts to InDesign as test cases--I still remember enough of PageMaker scripti[ng] that I should be able to translate. 
    That's very kind of you, thanks, but I think my problem will be finding the time to go through so many of them rather than figuring out the conversions. I'll post a problem if/when I hit one, but... are you perhaps in applescript-users? This forum is great, but I think I can have enough scripting without running into so much JavaScript all the time.
    Thanks,
    Roy

  • Finding text in a PDF using preview has stopped working (correctly)

    Finding text in a PDF using preview has stopped working (correctly).
    When I search for certain words in a PDF using preview, it correctly finds all the pages in the document with that word.  However, it no longer highlights the word being searched for.  I have looked through the various settings and cannot figure out how to turn this back on.
    Thanks.

    4Shared worked, but having to register to retrieve files from there is a nuisance.
    The problem is that you use special graphic state operators inside text objects which is not allowed:
    BT
    /printmatic_F1 58.133398014634 Tf
    q
    /DeviceCMYK CS
    1 1 1 1 SCN
    /DeviceCMYK cs
    1 1 1 1 scn
    0.62060289801053 w
    0 J
    0 j
    2.189349112426 M
    0 Tr
    /printmatic_F1 58.133398014634 Tf
    1 0 0 1 86.448306387737 264.65046258267 cm
    (t) Tj
    Q
    q
    /DeviceCMYK CS
    1 1 1 1 SCN
    /DeviceCMYK cs
    1 1 1 1 scn
    0.62060289801053 w
    0 J
    0 j
    2.189349112426 M
    0 Tr
    /printmatic_F1 58.133398014634 Tf
    1 0 0 1 102.60939103581 264.65046258267 cm
    (e) Tj
    Q
    q
    /DeviceCMYK CS
    1 1 1 1 SCN
    /DeviceCMYK cs
    1 1 1 1 scn
    0.62060289801053 w
    0 J
    0 j
    2.189349112426 M
    0 Tr
    /printmatic_F1 58.133398014634 Tf
    1 0 0 1 134.93156033194 264.65046258267 cm
    (x) Tj
    Q
    q
    /DeviceCMYK CS
    1 1 1 1 SCN
    /DeviceCMYK cs
    1 1 1 1 scn
    0.62060289801053 w
    0 J
    0 j
    2.189349112426 M
    0 Tr
    /printmatic_F1 58.133398014634 Tf
    1 0 0 1 163.99825933926 264.65046258267 cm
    (t) Tj
    Q
    ET
    Have a look at the PDF specification ISO 32000-1:2008 (e.g. at http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf). Table 51 shows that q, Q, and cm are special graphics state operators, and Figure 9 illustrates that these operators, therefore, are not allowed in text objects, i.e. between BT and ET.

  • AcroPDF in VB6 - Find text in PDF and print that page.

    Okay, so I'm certain that this question has been asked and answered a hundred times, but for some reason my googling skills are seriously failing me today...
    I have a legacy application built in VB6 that generates PDF documents of a particular form letter.  Each PDF contains all of the form letters that were printed on that particular day.  I actually have it all working rather decently, but something came up a little while ago that set me on a new programming obsession.  I want to enable the following functionality from my application:
    The user provides a text string that should be unique among all pages of all PDF's (customer ID).
    The application then finds the PDF that contains that text string and identifies which page number contains that text string.
    Finally, send only that page to the printer.
    Currently I can easily create, display and print the PDF from my application.  While the creation of the document is done through a third-party reporting system, all display and printing functions are basically handled using AcroPDF.dll.  Going through the available properties and methods for an AcroPDF object, I see that I can tell it to print only specified pages, which gives me the last part of my requirements, and I've got the user input part down pat.  I'm just totally stumped at finding a solution for "step 2".
    Any suggestions, ideas or comments would be greatly appreciated.  I'm kinda tired of banging my head against a wall.  Thank you for your time.

    If you are only using Adobe Reader, then that feature isn't available.
    If you have Adobe Acrobat, then you have a few options.
    From: Adobe Forums <[email protected]<mailto:[email protected]>>
    Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Date: Wed, 26 Oct 2011 08:15:12 -0700
    To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
    Subject: AcroPDF in VB6 - Find text in PDF and print that page.
    AcroPDF in VB6 - Find text in PDF and print that page.
    created by GHosaPhat<http://forums.adobe.com/people/GHosaPhat> in Acrobat SDK - View the full discussion<http://forums.adobe.com/message/3991293#3991293

  • Find text in pdf

    I need to develop a plugin that search for some text into the document, then when I found a particular string I need to examine the page where the text is found, and I need to export all the page as TIFF and also exporting all text in a text file.
    I suppose that I use the PD Layer. Anyone can give me a brief list of the function I have to use?
    Alk.

    The PDE layer is not recommended for finding text because
    * it is not broken into words
    * it may not be in reading order
    * there is no encoding conversion
    This means that you will only sometimes find text based on a simple
    scan of PDEText elements.
    In reading about AVConversion realise that there are two things being
    documented.
    1. How a plug-in can provide new formats for conversion to or from
    PDF. You do not want this.
    2. How a plug-in can use an existing AVConversion handler to convert
    to or from PDF. This is what you want.
    Aandi Inston

  • [AS][CS3] Finding text with character style

    Please help to tell me how to find text with a specific character style and then delete the text.
    I had no problem doing this with CS2 but its doing my head in now.
    Thanks,
    Andrew

    Here you go. This assumes that your character style is at the top level of the panel. If you're using style groups, you'll need to write code to get at the style you want to use.
    //DESCRIPTION: Delete text in named character style
    (function() {
      if (app.documents.length > 0) {
        deleteStyledText(app.documents[0]);
      function deleteStyledText(aDoc) {
        var cStyle = aDoc.characterStyles.item("CharStyleName");
        setupFindText();
        app.findTextPreferences.appliedCharacterStyle = cStyle;
        aDoc.changeText();
      function setupFindText(find, change, wholeWd, caseSense, foots, hidLayers, lockedLayers, lockedStories, masters) {
        app.findTextPreferences = null;
        app.changeTextPreferences = null;
        try { app.findTextPreferences.findWhat = find } catch(e) {};
        try {app.changeTextPreferences.changeTo = change } catch(e) {};
        app.findChangeTextOptions.properties = {
          caseSensitive:(caseSense == null ? false : caseSense),
          wholeWord:(wholeWd == null ? false : wholeWd),
          includeFootnotes:(foots == null ? false : foots),
          includeHiddenLayers:(hidLayers == null ? false : hidLayers),
          includeLockedLayersForFind:(lockedLayers == null ? false : lockedLayers),
          includeLockedStoriesForFind:(lockedStories == null ? false : lockedStories),
          includeMasterPages:(masters == null ? false : masters)
      } // end setupFindText
    Dave

  • Any plugin api to find text ?

    Hi
    Is there any plug-in api to find text in the pdf ? . In the acrobat_pdfl_api_reference.pdf, I don't see the description and function definition of
    PDFindText.
    So, I want to know how we can find text using the plug-in code ?
    Regards,
    Arvind

    Hi,
    I want to simulate find Text , find next feature in my application. And I think Acrobat Plugin will have some api similar to iac_api named
    CAcroAVDoc::FindText. But I didn't find in the plug-in reference document.
    And I also looked PDWordFinder sample code but looks like to simulate findtext thru this , we need to scan whole document first and then compare the word and then we need to highlight it. So good amount of code, I have to write to simulate FindText.
    So don't we have any other way or api by which we can simulate FindText, Find next  easily . And also I want to know which plugin api use PDFindFlags (mentioned in the plug-in reference document).
    Please let me know your inputs.
    Regards,
    Arvind

  • Ignore Line break in find text using grep

    Hi everyone!
    I need to find the text in document using grep.
    find text for :
    Xereptatiuria que alique volo eium qui dolupid ut
    voluptatiam earum saestorepel iuscit im quas et modisimodit.
    The above sentence cannot having line breaks. But document having multiple line breaks.
    so, please to give a tip to find the text using grep.
    I am not excepting this type of result by following.
    Xereptatiuriaque\n alique volo\neium qui dolupid ut\r voluptatiam earum\n saestorepel iuscit im quas et\n modisimodit.  ------------this is not.
    Any another way to find (i.e)., ignore the line break
    simply like this, 
    (?s:Xereptatiuria que alique volo eium qui dolupid ut
    voluptatiam earum saestorepel iuscit im quas et modisimodit.)      --------- the line break wherever it is found,ignore line break in single command.
    Thanks by,
    John Peter.

    johnp45247251,
    what do you really want to do?
    Like pkahrel in your other thread Find Grep And Ignore the line break said:
    pkahrel schrieb:
    You're a moving target: you change your question in each post. Do yourself a favour and go and read up on GREP.
    johnp45247251, one question:
    Could it be possible, that you doesn't understand correctly, how Grep really works?
    <edit by pixxxel schubser>
    Furthermore your example text is different to your screenshot. Your text is:
    »Xereptatiuriaque\n alique volo\neium qui dolupid ut\r voluptatiam earum\n saestorepel iuscit im quas et\n modisimodit.«
    And your screenshot shows:
    »Xereptatiuriaque\n alique volo\n eium qui dolupid ut \rvoluptatiam earum\n saestorepel iuscit im quas et\n modisimodit.«
    Normally the text should look like this:
    »Xereptatiuriaque\nalique volo\neium qui dolupid ut\rvoluptatiam earum\nsaestorepel iuscit im quas et\nmodisimodit.«
    Please explain what do you really want to do and exactly if additional spaces are exists or not!
    Could it be:
    you have a text with paragraphs and with many line breaks in that paragraph and there are no spaces exists before or after your line breaks. And is your destination to remove all the line breaks from your text?
    </edit by pixxxel schubser>
    Then the way is not to find the text completly and to ignore the line breaks – the way is to find the line breaks and replace with a space, e.g. like that:
    find:
    \n
    replace with:
    \s
    (change all)
    Regards
    pixxxel schubser

  • Find text and replace with image - Help needed

    Hi,<br /><br />We need to place the images as inline in the appropriate places.<br /><br />texttexttext<<test1.eps>>texttexttexttexttexttext<<test2.eps>>texttexttexttexttexttext< <test3.eps>>texttexttexttexttexttext<<test4.eps>>texttexttexttexttexttext<<test5.eps>>text texttext<br /><br />This code is helpful for placing a single image at a time, we are unable to place all the images in one shot, can anyone help me out.<br /><br />I am not a programmer.<br /><br />-----------<br />var myDoc = app.activeDocument; <br />app.findPreferences = app.changePreferences = null; <br />var math=document.search("test.eps"); <br />for (i=math.length-1; i >=0; i--)<br />{ myDir = Folder.selectDialog(); <br />AllGraphics = Folder(myDir).getFiles('test.eps') <br />for (i=0; i<math.length; i++) { app.select(anil1[i]); <br />     myDoc.place(AllGraphics[i],false); } }<br />-----------<br /><br />Note: I have taken this code from forum and we have made some changes on this.<br /><br />Kavya

    Jongware,<br /><br />I try running it but gives errors:<br /><br />Error Number: 55<br />Error String: Object does not support the property or method 'changePreferences'<br />Line: 24<br />Source: app.findPreferences = app.changePreferences = null;<br /><br />This is the code I used<br /><br />// Find text and replace with image for InDesign CS3 <br />// http://www.adobeforums.com/webx?128@@.3bbf275d.59b6f012<br />var heyItsAnArray = new Array ( <br /><br />   "it contains this line!", <br /><br />   "as well as this one", <br /><br />   "or even more!", <br /><br />   "test.eps" ); <br /><br />for (arrayCount=0; arrayCount<heyItsAnArray.length; arrayCount++) <br /><br />{ <br /><br />   replaceImg (heyItsAnArray[arrayCount]); <br /><br /> } <br /><br />function replaceImg (name) <br /><br />{ var myDoc = app.activeDocument;  <br />     app.findPreferences = app.changePreferences = null;  <br />     var math=document.search(name); <br />     for (i=math.length-1; i >=0; i--)  <br />     { myDir = Folder.selectDialog();  <br />          AllGraphics = Folder(myDir).getFiles(name)  <br />          for (i=0; i<math.length; i++) { app.select(anil1[i]); <br />               myDoc.place(AllGraphics[i],false); <br /><br />               } <br /><br />          } <br /><br />     }<br /><br />Michael

  • Find text place image

    Hello
    I have a script that find text and replaced it with a image, but it makes a new document and i want it in the same document that i have open.
    Can somebody help me with this problem. See script below. I work with Indesign CS 5 mac.
    Kinde regards,
    Patrick
    #target indesign
    var myDialogResult = CreateDialog();
    if (myDialogResult == undefined) exit();
    CheckIfChosenFoldersExist();
    var myIndFiles = [];
    var mySubFolders = [];
    CheckFolder(myDialogResult.indFolder);
    if (myIndFiles.length == 0) err("No InDesign files have been found in the selected folder and its subfolders.");
    var myStartFolder = myDialogResult.imagesFolder.parent;
    mySubFolders = getSubFolders(myStartFolder);
    WriteToFile("\r--------------------- Script started -- " + GetDate() + "---------------------\n");
    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
    for (f = 0; f < myIndFiles.length; f++) {
              ProcessIndFile(myIndFiles[f]);
    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
    app.findGrepPreferences = app.changeGrepPreferences = null;
    WriteToFile("--------------------- Script finished -- " + GetDate() + "---------------------\r\r");
    alert("All done!");
    // ------------------------------------------------- FUNCTIONS -------------------------------------------------
    function PlaceImages() {
              app.findGrepPreferences = app.changeGrepPreferences = null;
              app.findGrepPreferences.findWhat = '@.+?@';
              var myFoundItems = app.activeDocument.findGrep();
              for (i = 0; i < myFoundItems.length; i++) {
                        var myName = myFoundItems[i].contents.replace (/@/g, "");
                        var myFile = new File(myDialogResult.imagesFolder + "/" + myName);
                        var myFrame = myFoundItems[i].parentTextFrames[0];
                        if (myFile.exists) {
                                  PlaceIntoFrame(myFrame, myFile);
                                  continue;
                        if (!SearchInSubfolders(myName, myFrame)) {
                                  WriteToFile("\tNOT FOUND  -- " + myFile.fsName + "\n");
    function SearchInSubfolders(myName, myFrame) {
              for (j = 0; j < mySubFolders.length; j++) {
                        var myFolder = mySubFolders[j];
                        var myFile = new File(myFolder + "/" + myName);
                        if (myFile.exists) {
                                  PlaceIntoFrame(myFrame, myFile);
                                  return true;
              return false;
    function PlaceIntoFrame(myFrame, myFile) {
              try {
                        if (myFrame.characters.length < 100) {
                                  myFrame.getElements()[0].place(myFile);
                                  switch(myDialogResult.myRadSelected)          {
                                            case 2:
                                                      myFrame.fit(FitOptions.CENTER_CONTENT);
                                            break;
                                            case 3:
                                                      myFrame.fit(FitOptions.FRAME_TO_CONTENT);
                                            break;
                                            case 4:
                                                      myFrame.fit(FitOptions.PROPORTIONALLY);
                                            break;
                                            default:
                                            // do nothing
                        WriteToFile("\tPlaced -- " + myFile.fsName+ "\n");
              catch(e) {
                        WriteToFile("\tSome error occured while placing -- " + myFile.fsName + "\n");
    function CheckFolder(folder) {
              var fileList = folder.getFiles()
              for (var i = 0; i < fileList.length; i++) {
                        var file = fileList[i];
                        if (file instanceof File && file.name.match(/\.indd$/i)) {
                                  myIndFiles.push(file);
                        else if (file instanceof Folder) {
                                  CheckFolder(file);
    function getSubFolders(theFolder) {
              var myFileList = theFolder.getFiles();
              for (var i = 0; i < myFileList.length; i++) {
                        var myFile = myFileList[i];
                        if (myFile instanceof Folder){
                                  mySubFolders.push(myFile.absoluteURI);
                                  getSubFolders(myFile);
              return mySubFolders;
    function err(e, icon){
              alert(e, "Place Images Script", icon);
              exit();
    function ProcessIndFile(myFile) {
              try {
                        var myDoc = app.open(myFile);
                        WriteToFile(myDoc.name + "\n");
                        var myNewFile = new File(myFile.fsName.replace(/\.indd$/i, "_Backup.indd"));
                        myFile.copy(myNewFile);
              catch(e) {
                        WriteToFile("Cannot open file -- " + myFile.fsName + "\nError: " + e.message + " (Error# " + e.number  + ")\n");
              PlaceImages();
              myDoc = myDoc.save();
              myDoc.close();
    function CreateDialog() {
              var myIndFolder, myImagesFolder;
              if (app.extractLabel("Kas_PlaceImages_IndFolderPath") != "") {
                        var myIndFolderPath = app.extractLabel("Kas_PlaceImages_IndFolderPath");
              else {
                        var myIndFolderPath = "No folder has been selected";
              if (app.extractLabel("Kas_PlaceImages_ImageFolderPath") != "") {
                        var myImageFolderPath = app.extractLabel("Kas_PlaceImages_ImageFolderPath");
              else {
                        var myImageFolderPath = "No folder has been selected";
              var myDialog = new Window('dialog', 'Place Images');
              myDialog.orientation = 'row';
              myDialog.alignChildren = 'top';
              var myPanel = myDialog.add('panel', undefined, 'Choose folders for:');
              var myIndFolderStTxt = myPanel.add('statictext', undefined, myIndFolderPath);
              var myButtonInd = myPanel.add('button', undefined, 'InDesign files', {name:'indd'});
              var myImagesFolderStTxt = myPanel.add('statictext', undefined, myImageFolderPath);
              var myButtonImages = myPanel.add('button', undefined, 'Image files', {name:'images'});
              var myGroup = myDialog.add('group');
              myGroup.orientation = 'column';
              var myRadioPanel = myGroup.add('panel', undefined, 'After placing:');
              myRadioPanel.alignChildren = 'left';
              var myRadioBtn1 = myRadioPanel.add('radiobutton', undefined, 'do nothing');
              var myRadioBtn2 = myRadioPanel.add('radiobutton', undefined, 'center content');
              var myRadioBtn3 = myRadioPanel.add('radiobutton', undefined, 'fit frame to content');
              var myRadioBtn4 = myRadioPanel.add('radiobutton', undefined, 'fit content proportionally');
              if (app.extractLabel("Kas_PlaceImages_RadioSelected") != "") {
                        eval("myRadioBtn" + app.extractLabel("Kas_PlaceImages_RadioSelected") + ".value= true");
              else {
                        myRadioBtn1.value = true;
              var myOkCancelGroup = myGroup.add('group');
              myOkCancelGroup.orientation = 'row';
              var myOkBtn = myOkCancelGroup.add('button', undefined, 'Place', {name:'ok'});
              var myCancelBtn = myOkCancelGroup.add('button', undefined, 'Quit', {name:'cancel'});
              myButtonInd.onClick = function() {
                        myIndFolder = Folder.selectDialog ('Chose a folder for InDesign documents');
                        if (myIndFolder != null) {
                                  myIndFolderStTxt.text = myIndFolder.fsName;
              myButtonImages.onClick = function() {
                        myImagesFolder = Folder.selectDialog ('Chose a folder for Images');
                        if (myImagesFolder != null) {
                                  myImagesFolderStTxt.text = myImagesFolder.fsName;
              var myShowDialog = myDialog.show();
              if (myIndFolder == undefined) {
                        if (myIndFolderStTxt.text == "No folder has been selected") {
                                  myIndFolder = null;
                        else {
                                  myIndFolder = new Folder(myIndFolderStTxt.text);
              if (myImagesFolder == undefined) {
                        if (myImagesFolderStTxt.text == "No folder has been selected") {
                                  myImagesFolder = null;
                        else {
                                  myImagesFolder = new Folder(myImagesFolderStTxt.text);
              var myRadSelected;
              if (myRadioBtn1.value) {
                        myRadSelected = 1;
              else if(myRadioBtn2.value) {
                        myRadSelected = 2;
              else if(myRadioBtn3.value) {
                        myRadSelected = 3;
              else if(myRadioBtn4.value) {
                        myRadSelected = 4;
              app.insertLabel("Kas_PlaceImages_RadioSelected", myRadSelected + "");
              app.insertLabel("Kas_PlaceImages_IndFolderPath", myIndFolderStTxt.text);
              app.insertLabel("Kas_PlaceImages_ImageFolderPath", myImagesFolderStTxt.text);
              if (myShowDialog== 1) {
                        var myResult = {};
                        myResult.indFolder = myIndFolder;
                        myResult.imagesFolder = myImagesFolder;
                        myResult.myRadSelected = myRadSelected;
              return myResult;
    function WriteToFile(myText) {
              myFile = new File("~/Desktop/Place Images Report.txt");
              if ( myFile.exists ) {
                        myFile.open("e");
                        myFile.seek(0, 2);
              else {
                        myFile.open("w");
              myFile.write(myText);
              myFile.close();
    function GetDate() {
              var myDate = new Date();
              if ((myDate.getYear() - 100) < 10) {
                        var myYear = "0" + new String((myDate.getYear() - 100));
              } else {
                        var myYear = new String ((myDate.getYear() - 100));
              var myDateString = (myDate.getMonth() + 1) + "/" + myDate.getDate() + "/" + myYear + " " + myDate.getHours() + ":" + myDate.getMinutes() + ":" + myDate.getSeconds();
              return myDateString;
    function CheckIfChosenFoldersExist() {
               if (myDialogResult.indFolder == null) {
                        err("No folder has been chosen for InDesign files.", true);
              else if (myDialogResult.indFolder.constructor.name == "Folder") {
                        if (!myDialogResult.indFolder.exists) {
                                  err("Folder \"" + myDialogResult.indFolder.fsName + "\" chosen for InDesign files does not exist.", true);
              if (myDialogResult.imagesFolder == null) {
                        err("No folder has been chosen for pictures.", true);
              else if (myDialogResult.imagesFolder.constructor.name == "Folder") {
                        if (!myDialogResult.imagesFolder.exists) {
                                  err("Folder \"" + myDialogResult.imagesFolder.fsName + "\" chosen for images does not exist.", true);

    Try this, I use it every day
    /*******************ImagePlacer***************************
        this script will addimages to the document by
        substituting them with the name of the image file
        between @s (file format included[@mypic.bmp@]),
        selecting them from a specified file (see below)
        and applying object styles to them, as well as
        applying the right tab i necesary.
        It then looks for overflows in the document. If an
        overset is found, it will resize to margin size the
        text frame and if overset continues, it will add a
        new page and frame, which then will be linked
        to the previous frame, allowing the story flow.
        Questo file deve essere copiato nella cartella Script di InDesign
    //Creates a new document using the specified document preset.
    //Replace "myDocumentPreset" in the following line with the name
    //of the document preset you want to use.
    var myDocument = app.documents.add(true,app.documentPresets.item("MyPreset"));
    //If the active document has not been saved (ever), save it.
    if(app.activeDocument.saved == false){
    //If you do not provide a file name, InDesign displays the Save dialog box.
    app.activeDocument.save(new File("/Users/paolbot/Desktop/Document.indd"));
    function main()
    var myDocument = app.documents.item(0);
    var myPage = myDocument.pages.item(0);
    var myTextFrame = myPage.textFrames.add({geometricBounds:myGetBounds(myDocument,myPage)});
    myTextFrame.textFramePreferences.textColumnCount = 7;
    myTextFrame.place(File("/Users/paolbot/Desktop/text.txt"));
    //Place a text file in the text frame.
    //Parameters for TextFrame.place():
    //File as File object,
    //[ShowingOptions as Boolean = False]
    //You'll have to fill in your own file path.
    //Define GREP search
    var grepFind ="@@@.+@@@";
    //Name of the folder where pdf are
    var myFiguresFolder = "pictures";
    // Stile Paragrafo applicato
    var myPStyle = myDocument.paragraphStyles.item("Normal");
    var NextPStyleCS = myDocument.paragraphStyles.item("Par_Style");
    var NextPStyleEN = myDocument.paragraphStyles.item("Par_Style_en");
    var NextPStyleDE = myDocument.paragraphStyles.item("Par_Style_de");
    // Text style applied
    var myCStyle = myDocument.characterStyles.item("text");
    //Object style applyed
    var myOStyle = "";
    var oStyle_1 = myDocument.objectStyles.item("Pictures");
    var oStyle_2 = myDocument.objectStyles.item("Pictures");
    var oStyle_3 = myDocument.objectStyles.item("Pictures");
    //MEASUREMENTS
    var maxWidth = 467; //Maximum width of an image
    var maxHeight = 666; //Maximum Height of an image
    var colWidth = 468; //Width of the main columb (340pt) + maximum Tab (128pt)
    var maxTab = 0;
    var xTab;
    var xtTab;
    var minTWidth = 340; //any image with a width below this will have the maximum Tab (maxTab) applied.
    var PWidth; //Width of the Picture
    var PHeight;//Picture Height
    var myTotal;

Maybe you are looking for