Find and move text within the existing framework of anchored

I have a great story that spans several pages text. It contains a number of paragraphs that have the following content:

[empty anchor for an existing character, but the anchor text frame] [important book that contains NO tab] [TAB] [intermediate text containing NO tab] [TAB] [end text containing NO tab] [empty anchor for an another existing character, but the block of anchor text]

I need a script (Javascript, preferably) that:

1. find a paragraph that starts with a character of anchor;

2. find and cut the main text between the character of the anchor and the first TAB after

3. Paste the main text in text anchored at the beginning of the paragraph;

4. in the same paragraph, find the final text between the second (and last) TAB and the character of the second (and last) anchor at the end of the paragraph;

5. glue the final text under text anchored at the end of the paragraph;

6. repeat 1. -5. for the paragraph all in the same article that starts with a character of the anchor.


I'm a JS programmer advanced, but new scripts CreativeSuite. I just understood how to search for some text, and I know that the 'parent' of an anchored object is a 'character' - but now to I access the contents of an object anchored to its parent character?


Even better:

function movetoanchored(find) {
  var myText = find.characters.itemByRange(1, -1).texts[0];
  var myFrame = find.characters[0].textFrames[0];
  myText.move(LocationOptions.AT_BEGINNING, myFrame);
};

function main() {
  var myStory = app.selection[0].parentStory;
  app.findGrepPreferences = app.changeGrepPreferences = null;
  app.findGrepPreferences.findWhat = "^~a\\S+";
  var myFinds = myStory.findGrep(true);
  for (i = 0; i < myFinds.length; i++) movetoanchored(myFinds[i]);
  Window.alert(myFinds.length + " moves performed");
};

app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "MoveToAnchored");

Tags: InDesign

Similar Questions

  • How to find and replace text in the index entries?

    Hello

    Recently, I copied a manual to create a new one for another product. After a global search and replace the product names and other texts, I needed to replace a specific word that appears in the index entries.

    I noticed the search box would allow me to search the text of the marker, but I had to replaceme the word by hand - cut and paste the new Word, click on change the marker to save it and then find the next occurrence.

    It's with frame 7.2. Does anyone know a faster way to do this?

    Yours,

    Michael F.

    =========

    Peter,

    Thanks for the lead.

    I downloaded the zip file and all it contains is a DLL file, but no instructions.

    What should I do to make it work and how do I know that it works?

    Yours,

    Michael F

    ========

  • Find and replace text in documents invisibly

    Hello

    here in this forum I found the Russ find/replace function in ExtendScript, with which you can find and replace text. The script works perfectly when the documents are opened. In the case of invisibly open documents, that the script does not work since TextSelection is obviously applied. Refer to link:

    https://forums.Adobe.com/message/4032650#4032650

    I want to find and replace text within a structure of book, it would be useful if I could do it in documents that are not visibly open (Constants.FS_MakeVisible = false). Does anyone have an approach to find and replace in documents that are not visibly open? Or can someone confirm that this is only possible with TextSelection, which means that it does not work in documents open invisible?

    Thank you very much!

    Concerning

    Apollo102

    Apollo,

    I looked into this and I was able to reproduce the problem. Unfortunately, I wasn't able to find a perfect solution. Running in the debugger, I found that the failure occurs with the Find() call. All paragraphs, the text ranges, etc. are valid... it's just that the Find() call fails to find anything.

    I found that if you turn on/off the display, all of a sudden the Find() operation works with the hidden document:

    doc. IsOnScreen = true;

    doc. IsOnScreen = false;

    I don't know if this is a practical solution and of course, you may as well open visible in the first place. Would be of no help to just disable the updates with the interface?

    App. Display = false;

    Just be sure to return true at the end of the script

    I'm sorry I couldn't find a complete solution. It might be possible to appeal to something that makes the hidden document searchable, but I did not understand it.

    Russ

  • After the update of Photoshop 2015 CC welcomes "check spelling...". "and"find and replace text... "are disabled.

    Welcomes to "check spelling...". "and"find and replace text... "are disabled after I updated to Photoshop 2015 CC.

    Does anyone have a solution?

    Thank you
    Eli

    Someone has found a work around that.

    The link below.

    But is not ideal could be useful as the current problems with the point highlight text/right click on/off "check spelling" options disabled after that update CC 2015 is ruining your workflow.

    Spellchecker not available in Photoshop CC 2015

  • Find and replace text with formatted text.

    I am trying to replace the text ' ^ 2 ' with '2' on photoshop by a search and replace, because there are many cases that on my image, but I can't seem to access any feature in photoshop which can do a search and replace for anything other than simple text. Is there a css solution, or a plugin that would allow me to do this? I have not sought on anything either on google search, although I will update this thread if I find something

    Google found this discussion Forums Adobe with different versions of the script.  I don't know exactly what made the script, but maybe it would work.  You probably want to make a backup of your documents before you run it:

    Find and replace text in multiple files from Photoshop?

  • Find and replace text in hyperlinks

    I want to find and replace text inside all hyperlinks inside my documents.  What property of the hyperlink hyperlink text items is stored in?

    I know that the text that the hyperlink is applied is stored in:. source.sourceText.contents myHyp [len]

    But where is stored the hyperlink itself?

    Say that I have a bunch of hyperlinks that look like: " " https://www.website.com/subsite1/Page1.html?ID=123 "

    I want to find and replace "subsite1' with 'subsite2' in order to implement all the links" " https://www.website.com/subsite2/Page1.html?ID=123 "

    Thank in advance for any assistance.

    Hello

    change . destination.destinationURL myHyp [len]

    In your case:

    // ...............
    var
         myDest = myHyp.destination.destinationURL,
         myDest = myDest.replace("subsite1","subsite2");
    
    myHyp.destination.destinationURL = myDest;
    // ...............
    

    Jarek

  • Peut funtion Vmotion and Storage Vmotion with Intel and AMD hosts within the same cluster

    Hi, I can do storage Vmotion OR Vmotion between Intel and AMD hosts within the same group?

    Thank you

    No, it is not possible to vmotion or storage vmotion between CPUs from different manufacturers - I heard rumors that two manufacturers are working on technology that will help in the future-

    If you find this or any other answer useful please consider awarding points marking the answer correct or useful

  • Generate public and private keys within the smart card

    Hi all

    I use this code to generate public and private keys within the smart card.

    KeyPair kp = new pair of keys (KeyPair.ALG_RSA_CRT, KeyBuilder.LENGTH_RSA_512);
    kp.genKeyPair ();
    PrivateKey prikey = kp.getPrivate ();
    PublicKey pubkey = kp.getPublic ();

    This code runs without error.

    I need to obtain the public key of the smart card. So I need to get the public key to a byte array.
    But I can't get these keys in array of bytes of plain text.

    The methods I can get for pubkey object are

    pubkey.clearKey ();
    pubkey. Equals (obj);
    pubkey.getSize ();
    pubkey.getType ();
    pubkey.isInitialized (); only these.

    I use
    Eclipse Version: 3.4.1 (level of agreement of the compiler = 1.4)
    Jcop plugin (to connect with the real map and to test the java code in virtual card provided by JCOP)
    OmniKey5321 (characters without contact) card reader

    What is the reason to get those above methods pubkey object? Is it a version problem?
    How can I get the public key in ordinary byte array? Is this possible?
    If it is not possible, is there a way to get the public key as a certificate of export or something another solution?

    If my script is not a possible strategy, how can I use private public keys to send the applet-specific data? Is there a better way to do it?

    Published by: 863766 on June 6, 2011 12:16 AM
    RSAPublicKey pubkey = kp.getPublic();
    

    then

    pubkey.getExponent(...); pubkey.getModulus(...);
    
  • Move text in the Air

    Salvation Group

    I want a marquee in the AIR, Im using Adobe Flex Builder (one on eclipse). Move the text can be carried out on the use of flex
    < mx:move / >

    However this doesnot work on AIR.

    So I would like to know.

    1. how to move text in the AIR. (but obvious).
    2. where can I find APIs for MX for AIR training.
    3 How to achieve no matter what chart (flight of ducks for example).
    4. who is the next president (just kidding;).

    Concerning
    REDA



    I think that most if not all what you can do in Flex you can do in the AIR:

  • ITunes is downloading all items purchased from my iPhone, including tv shows and movies, using all the memory and batteries

    ITunes is downloading all items purchased from my iPhone, including tv shows and movies, using all the memory and batteries, does anyone know how to stop this?

    Hi anthony248,

    If you don't want the automatic downloads enabled on your iPhone, follow the steps outlined in the article below, except that you will turn off the switch rather than turn them on.  I'll also include a link about the storage capacity of your iPhone and how to delete items that you don't want.

    Turn on automatic downloads

    Check your storage space on your iPhone, iPad and iPod touch

    Take care

  • How to copy and paste text from the page of the book one photo to another.

    Hello, I downloaded this software 2 days ago, and I had so much fun with it. pls I need help on how to copy and paste text from the page of the book one photo to another. Second, how to copy my photo book completed pages project to another laptop computer for printing. Thank you

    Wow! I solved the first problem, I clicked on 'ctrl c' to copy and "ctrl v" to paste. yipppppeee! now am loving this software d most just need help with the second question now

  • How to delete a single text and add text to the image in photoshop cc?

    How to delete a single text and add text to the image in photoshop cc?

    Please try again by following the link: How to remove the text from the Image in Photoshop - YouTube

  • setValue for entering text within the pop-up window giving NullPointerException

    Hi all

    I want to put the value programmactically for entering text within the pop-up window

    I write the following code in the bean (extended view)

    to fill the text to enter the PopupFetchListener

    {} public void setMyInput (myInput RichInputText)

    this.myInput = myInput;

    }

    public RichInputText getMyInput() {}

    return myInput;

    }

    {} public void fetchText (PopupFetchEvent popupFetchEvent)

    Add the code in the event here...

    myInput.setValue ("test"); gives NullPointerException

    }

    JDeveloper 12 c

    First, link component UI (with the exception of fragment) to the scope of request bean.

    Then, try to play with the popup childCreation property (try with immediate)

  • How can I find and get rid of the duplicates

    How can I find and get rid of the duplicates

    Hi sinkerslider,

    I apologize for the long delay. In what app work? Looking for double .jpgs, PSD etc files. ? Also, what device and operating system are you using? Thank you very much!

    -Kathleen

  • How to add and edit text in the form created by adobe acrobat 9?

    How to add and edit text in the form created by adobe acrobat 9?

    Actually, that's exactly what you should do, you don't need to create

    all fields again.

    After you have edited the original and create a new static PDF, open the old

    version and use the command replace Pages to insert the new pages

    those in the old file. This will keep all the form fields in tact.

    Tuesday, August 25, 2015 at 10:28, susanna323 [email protected]>

Maybe you are looking for

  • Terminate ANY order for CVI

    I have three performances running. What is the command in CVI to end all executions when a custom button terminate is reached. Currently using TSUI_ExecutionViewMgrTerminateExecution (gmainWindow.executionViewMgr, & errorInfo); What is the correct co

  • CP1515n - launch the installation CD on each cell unique in the WIFI network?

    Hello world Can be My question is too basic, at least I couldn't find an answer in this forum, or... .any info explicitly in textbooks: I have installed successlully the cp1515n since the installation CD, and allows to print from my computer 'host' (

  • Printable DVD?

    Is there an adapter that allow (hp photosmart all-in-one) 2610v to print directly on a DVD?

  • Where is able to select the GPS data source?

    Hi, guys. I have a question about the GPS. I want to know the source of GPS data. I think that 2 types of sources of GPS data as internal device of GPS and Bluetooth GPS Receiver. If the user has a BB with chip GPS and Bluetooth GPS Receiver, where i

  • Partial triggers does not work for my application

    my code like this:....< af:selectOneChoice id = "soc1.Binding = "#{createProjectBean.proCategory} '"valueChangeListener = "#{createProjectBean.selectChange} '"rendering = "true" required = "true".autoSubmit = "true" >< f: selectItems value = "#{bindi