Script - Paste a TextFrame into a TextFrame

Hi,
I am very new to Indesign Scripting (1 week?).  Getting stuck trying to Paste a TextFrame inside another TextFrame.  I can do it in the UI and successfully wrote a script to do this:
app.select(someTextFrame);
app.copy();
app.select(pasteIntoTextFrame.insertionPoints[0]);
app.paste();
Where someTextFrame is the TextFrame I am trying to copy into the PasteIntoTextFrame....
But, this doesn't work on InDesign Server.
Example / Reason: TextFrame1 willl be centered, Then TextFrame2 will be aligned right, TextFrame3 centered, TextFrame4 aligned right. 
Then all of these are pasted into the 'Master' text frame with its own alignment options
Hopefully the diagram will help explain my poor description.
Can anyone point me in the right direction? Thanks

Hah -- that was quite difficult to pull off. You are correct in your observation that IDCS Server cannot use 'select', 'copy', and all other UI based commands, so you have to do it purely by manipulating the objects.
Unfortunately, all objects do have a 'move' method but ... it only can accept some page position and not an insertion point, which is what you need here. So there is no way to physically move an existing text frame into text (or, for that matter, a button, or a rectangle, line, ellipse or anything else).
But you can create a new object in-line:
mynewTextFrame = app.activeDocument.stories[0].insertionPoints[3].textFrames.add();
will create a new text frame between characters numbered 3 and 4 -- between the two letters "l" if the first word in the first story is "hello there!". Then you can move your existing text out of "someTextFrame" into the newly created frame, and copy as much other parameters as you need to it. Finally, you can delete the original frame (or perhaps move it out of the way onto the pasteboard, since you never know what you might need it for).

Similar Messages

  • Script - Paste a Group into a TextFrame

    Very similar to my last question here - http://forums.adobe.com/message/4167532
    In Indesign desktop I can copy and paste a group inside a text frame - obviously this can't be done in Indesign server.
    I have tried looking at the duplicate and move methods - but these don't take a page item as the 'to' parameter.
    var textFrame = myPage.pageItems.item("TextFrame");
    var group1 = myPage.pageItems.item("group1");
    var group2 = myPage.pageItems.item("group1");
    I can remove items once they are already in the text frame with
    textFrame.pageItems.item(0).remove();
    PageItems is read only - so I can't add items to it.
    Suggestions?

    Alas -- the following did not work, although it does with another kind of item (try with "rectangles.add", that works). It may give you some fresh ideas, so I'm showing it anyway:
    textFrame = app.selection[0].parentTextFrames[0];
    group1 = app.layoutWindows[0].activePage.parent.groups[0];
    group1elements = group1.ungroup();
    textFrame.insertionPoints[1].groups.add(group1elements); <-- fail!
    You can test this in the UI version with (1) some group, and (2) a text frame with the text cursor inside it.
    The "fail" line errors out with
    JavaScript Error!
    Error Number: 24
    Error String: textFrame.insertionPoints[1].groups.add is not a function
    File: zzztry.js
    Line: 5
    Source: textFrame.insertionPoints[1].groups.add(group1elements);
    which is kind of a bummer.

  • [JS][CS35.5]Place a previously created item/textframe/group onto a page/into a textframe anchored

    Hi all. I'm an experienced programmer but very new to indesign scriping.  I've been working through a book and some tutorials and it's coming along pretty well.  I'm also no Javascript pro.
    My project is to parse some inDesign files that I have made as "templates" and fill in placeholder text I have created with data from a file.  The data can be single words or phrases or long sequences of styled paragraphs.  That's all working.  I can even do it without making the document active which is especially pleasing because it feels more automated not to have the new document open while the script is running.
    However, now I want to do something I did with my previous system (OpenOffice Writer + Docmosis) which is to place a little group of a textbox + icon with a drop shadow in certain parts of my document.
    Here is an idea of what I mean: http://fireplan.ca/images/stories/firewatch.png
    Since I add large amounts of text and add pages manually to flow it I need to make sure this box will stay with the text it is associated with (in this case, the fire watch paragraph).  I don't know if there is a good way to copy this element in from another document or to create it with a script or what.  My solution so far has been lame.  I create the textFrame, include subframes and graphics as I see fit, and then put it in the document with a name (InfoBox) and set it to be invisible.  Then, if I run across a situation where I want to include it, I do something like:
    var sourceTextFrame=findTextFrame("InfoBox",theDoc);
    var objectDupe=sourceTextFrame.duplicate();
    objectDupe.visible=true;
    objectDupe.name=objectDupe.name+"-placed";
    app.select(objectDupe);
    app.cut();
    app.select(theStory.paragraphs[newParagraphIndex].insertionPoints[0]);
    app.paste();
    /* This code an be optimized and improved I'm sure but for now it's doing the job and is not the basis of my question */    
    function findTextFrame(frameName,theDoc){
                var allItems=theDoc.allPageItems;
                for(var a=0;a<allItems.length;a++){
                  if(allItems[a].name==frameName){
                   return allItems[a];
                return null;
    Basically I paste a visible copy of the info box into my main textframe in the appropriate place.  This technique of using app.select, app.cut, and app.paste just seems lame. It also means I have to make the document the active document so I can use cut and paste.
    Any suggestions or ideas about how to achieve this sort of thing more cleanly?

    Just a quick follow up.  The direction I thought I would go on this if I was more experienced would be to look at the Indesign CS5.5 scripting guide and focus on the area about creating an anchored frame.  This basically creates a text frame inside an existing frame and anchors it there.  It seems like there should be some way to use a similar approach to move the contents of my existing objectDupe into this anchored frame, or simply add the objectDupe instead of creating the anchored frame in the first place.
    So for example the code in the scripting guide is something like:
    var myInlineFrame = myInsertionPoint.textFrames.add();
    I thought it would be nice if you could do something like myInsertionPoint.textFrames.add(objectDupe);
    or objectDupe.moveTo(myInsertionPoint);
    var myInlineFrame = myInsertionPoint.textFrames.add();
    myInlineFrame.textFrames=objectDupe.textFrames;
    or
    myInlineFrame.contents=objectDupe.contents;
    Of course, I realize none of these things will work, but it just seems like there should be a way!?
    Perhaps I will have to look further into snippets.  I saw a blog post that allows you to place snippets inline by putting them in a library first.. maybe that'll work.
    Any further comments are more than welcome!

  • Script Indesign CS3 - Split multicolumn TextFrame to separated TextFrames (For PC)

    any one know what script can make it ???
    ike this...
    http://img402.imageshack.us/img402/905/20080517085017hb3.jpg

    Loic, great job, that's a very useful script!
    I found myself using it a lot, so I created an enhanced version, borrowing a few lines from yours, I hope that's ok with you. My script fixes most of the problems, and it installs itself in InDesign's menu system, so it is virtually indistinguishable from a built-in command. Once you run it, you can reach it via "Object > Break Into Columns". If you set the script to load when InDesign starts, you don't even have to use the scripts panel at all.
    Fixes/Enhancements over Loic's version/previous versions (hope I get that formatting right):
    * The code no longer uses script labels. Existing script labels are no longer lost and the command can be run more than once per document without manually clearing out all script labels first.
    * The script now installs itself into InDesign's "Object" menu. The menu item is disabled automatically if the command cannot be run (for example if no text frame is selected).
    * Frames with only one column are handled correctly
    * Z order is preserved
    * Text Frame attributes such as Fill, Stroke etc. are preserved
    * Locked frames are handled correctly (i.e. the command is grayed out)
    * Text threads are preserved
    * Assigned InCopy frames are dealt with correctly. They used to lose the link to the original story file and end up as "Unassigned InCopy Content"
    * Assigned InCopy frames no longer need to be checked out for the script to work
    * The new frames end up on the same layer as the original one
    * The new frames end up on the same page/spread as the original one, rather than being placed on the first page of the document
    Know Issues:
    * Choosing "Edit > Undo" will undo the script in steps. I don't know if there is a way for scripts to act as transactions in the scripting interface, but using the C++ API just for that is probably not worth it.
    * Transforms such as rotated frames are not handled correctly
    * Only InDesign 5.0 (CS3) and above is supported
    Here is the download link:
    http://www.sendspace.com/file/s9fcae
    Hope this is useful.
    Peter

  • I get this message when trying to past simple text into an e-mail document. The Web-Based Email plugin has crashed. I have run out of options...please help.

    The Web-Based Email plugin has crashed. I get this message when trying to paste simple text into an email document. I have updated plugins and have run out of options. If I use another browser I have no problem. Please advise.

    UPDATE
    Compiling from command line I found out that the class definition for oracle.oats.scripting.modules.basic.api.IteratingVUserScript is missing. Do you know what .jar file contains this class?
    Thanks.
    Fede.

  • CS5: Pasting smart quotes into code view problem

    Hi all,
    In my blogging workflow, I copy the blog text from from MacJournal into the code view in Dreamweaver CS5.  In CS3, it seems that DW allowed the left & right smart and unicode quotes to be pasted in untouched.  However, DW CS5 seems to be converting all single ‘ & ’ to the ASCII ' and all “ & ” to ASCII ".  Is there a way to turn this off?
    I don't want to paste the text into the design view because I don't want DW to auto format the text.  I got some specific formatting that I like to do.
    Thanks!
    Steven

    Yes, the appropriate meta tag is in place.  In Preferences, UTF-8 is selected under Fonts.  Try pasting:
    “Test”
    into the code view and see what happens.  Hmm, Just tried pasting the above into the Design View and the same thing happened.  The curly quotes where changed into straight quotes.  BTW, I'm runn ing DW under Mac OS X Lion.
    I pasted the same text in another app, TextEdit, and the curly quotes pasted just fine.
    I need the curly quotes because I change them into &#8216;, &#8217;, &#8220;, and &#8221; (‘ ’ “ ”) for compatibility with older browsers (pre-IE6).  Yes, my site has been visited by such older browsers.
    Thanks!
    Steven

  • Since switching to Yosemite, I am unable to paste any information into calendar events, instead having to type out all info such as location, notes, etc.  This is true both in daily view and weekly/monthly views as well.  Help?

    Since switching to Yosemite, I am unable to paste any information into calendar events, instead having to type out all info such as location, notes, etc.  This is true both in daily view and weekly/monthly views as well.  Help?

    You welcome

  • I am looking for an application that would allow me to open a word doc, and take notes in the .doc using a stylus pen.  I'd then like to convert those notes to text, and then be able to copy / paste those notes into an email.  Does this app exist?

    I am looking for an application that would allow me to open a word doc, and take notes in the .doc using a stylus pen.  I'd then like to convert those notes to text, and then be able to copy / paste those notes into an email.  Does this app exist?  It seems like we were doing these same types of things with Palm Pilots years ago, one would think this would work with iPads?

    I don't believe it will open a Word document, but Writepad allows for handwritten conversion of notes to text and then to email. Might help you some of the way...

  • Cannot copy and paste from Word into Mail

    I cannot copy and paste from Word into Mail. Neither from using the keyboard shortcuts, or using the Menu function. I can copy and paste from other applications into Mail- but for some reason, text copied from a Word document (both in .txt and .doc formats) will not paste into an open email. Anyone else have this issue? It's a new issue. I used to be able to do this easily.

    I had similar issues starting about the same time or within the past week. However, I can copy and paste, it just takes considerably longer than it used to before. Copying something from a web page into Word could take up to 30 seconds now on my computer but it shows a busy mouse pointer while it is loading, then clicks/pops when it loads into the Word document, but then actually takes about another 5 to 10 seconds to appear in the Word document. I have no idea why it is delaying now when it did not do it before, but since it is still going into the document I am living with it for now. Are you waiting long enough to see if it appears?

  • Firefox 6 will not allow you to paste a cookie into the addressbar like all previous versions have. I use software to replace web chat and must do this and have been able to do it in all past versions. What's the deal?

    Firefox 6 will not allow you to paste a cookie into the addressbar like all previous versions have. I use software to replace web chat and must do this and have been able to do it in all past versions. What's the deal?

    Thank you for your response.
    After searching around for any pointers to my problem, the above fixes I listed were the things that came closest to maybe addressing the issue, that I was able to locate. But since none worked, and as you pointed out, it is now clear they will only help towards viewing sent images rather than helping with inserting any images in the body of the email, which is the problem I suddenly started facing today.
    Coming to your suggestion, on opening the Write window, the Insert choice on the menu bar is indeed available. And I had already tried using that, by clicking on the '''Insert ----> Image''' option listed. That opens
    up the "Image Properties" box but using that has not resolved the matter either. It results in an image box getting inserted within the email but without the actual image itself.
    Plus, normally I am able to use the '''Paste''' function in the Edit menu or through right-click, but today the (Cut/Copy/Paste) functions have gone inactive, thereby disallowing me to use that to place an image within the email.

  • How do I copy, paste Word document into Adobe Reader PDF?

    A client is not using Microsoft Word, but typing text for my edits into Adobe PDF. Too many edits, too cumbersome for me. After converting PDF to Word, I edit using various ink colors. How can I copy, cut, paste edited WORD document into her PDF? Other than by using "paper clip" or "attachment" features?

    Thanks, graffiti...So, can't copy, paste Word document into PDF?
    What is the "full version" of Adobe vs my Adobe Reader? Adobe Acrobat?
    I do have a cloud, but doesn't help with my editing problem.

  • Flex application works locally, fails when online (connecting to PHP script to insert row into DB)

    Hi everyone,
    I've got a Flex application that works wonderfully when I test it on my machine locally. It uploads files and send variables to a PHP script (that inserts them into a DB) with no errors when I run it locally. As soon as I put it online, the upload continues to work but something between my Flex application and the PHP script fails because no data is committed to the DB. I know the PHP script works fine - not only does it work when I run the Flex application locally but when I go directly to the PHP file online, a new empty line is added to the DB.
    I initially thought that this was a cross domain issue so I added the following to the root of my hosted account:
    <cross-domain-policy>
    <site-control permitted-cross-domain-policies="all"/>
    <allow-access-from domain="*.MYURL"/>
    <allow-http-request-headers-from domain="*.MYURL" headers="*" secure="false"/>
    </cross-domain-policy>
    I based this off of what I found online which seems to have done nothing for me. I'd also be happy to provide an error message but I don't get one when I debug.
    Any thoughts would be greatly appreciated.

    Use a network monitor to see if the Flex app is truly requesting the right URL.
    -Alex

  • Paste Google code into template?

    Hi all – I am trying to get my company site recognized by Google's tracking software. I am using templates, and trying to paste the code into the master template. The code as viewed in my Dreamweaver file is multi-colored and I cannot paste into the place where it is needed. Can you tell me why this is, and more importantly, how to remedy the situation?

    Here it is to the </head> tag. I think I've included all the important code (since Google wants their code put in before </head>.).
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <meta name="alexaVerifyID" content="95U4t0_M0WeCXeUdZ-WPwQzaUAc" /><html>
    <link href="../black text.css" rel="stylesheet" type="text/css"><head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <!-- TemplateBeginEditable name="doctitle" -->
    <title>Untitled Document</title>
    <!-- TemplateEndEditable -->
    <!-- TemplateBeginEditable name="head" -->
    <!-- TemplateEndEditable -->
    <style type="text/css">
    <!--
    body,td,th {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #006600;
    body {
    background-color: #CCCCCC;
    background-image: url();
    margin-left: .5in;
    margin-top: .5in;
    margin-right: .5in;
    margin-bottom: .5in;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 9px;
    font-style: normal;
    a {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #0000CC;
    font-weight: bold;
    a:visited {
    color: #FFFFFF;
    text-decoration: none;
    a:link {
    color: #006600;
    text-decoration: none;
    a:hover {
    text-decoration: none;
    a:active {
    text-decoration: none;
    .phone {
    font-size: 16px;
    .phone {
    text-align: center;
    -->
    </style></head>
    <body>
    I copied it directly from the code. I don't know if this matters or not, but the code is multi-colored, which didn't come through in the pasting. I appreciate your help...

  • Is it possible to paste two images into one layer?

    I'm having some issues pasting two images into one layer. Every time I paste the second image, it automatically creates a new layer...is there anyway to prevent that from happening? I'm making an animation on photoshop and I want there to be more than image in some of the frames. Please let me know if you have any suggestions! Thanks!

    You can merge the two layers together once they're position. Select the top layer and choose merge down or select both and choose merge layers (from the layers menu).
    http://help.adobe.com/en_US/Photoshop/11.0/WSfd1234e1c4b69f30ea53e41001031ab64-78b2a.html

  • Adobe Photoshop asked me to copy and paste a URL into my "browser" to confirm my e-mail address. What, and where, is my Browser? How do I do that?

    Upon register with Adobe Photoshop, they asked me to copy and paste a URL into my "browser" to confirm my e-mail address. What, and where, is my Browser? How do I do that?

    If this has arrived in an email from Adobe, it's probably legitimate.
    Usually though, you can click the link and it will confirm your registration automatically.
    Otherwise copy it and then paste it into the location bar.
    '''N.B.''' See this link for possible malware: http://www.adobe.com/support/reader/

Maybe you are looking for

  • Problem with WT2007, SBO2005 and Opportunities

    I am trying to synch opportunities between WebTools 2007 PL3 and SBO 2005 PL31 but every opportunity errors with the following error: -5002:Potential amount is missing  [OPR1.MaxSumLoc][line: 3]    at NetPoint.SynchSBO.SBOObjects.SBOOpportunity.NetPo

  • How to type a Copyright Symbol

    does the new elements 11 have the uk copyright symbol in the text options. Message title was edited by: Brett N

  • In which table we can find the sessions log

    Hi all, I am using BDC using session method,I need to know the  table in which session log is getting updated, one more thing could I able to find the session log for the past one year in SM35, plz help me out. regards paul

  • Does family share function work with the family members in China?

    I have two family members who use iphones in China. I wonder if family share works with them overseas. Thank you.

  • Naming your top level domain

    I am setting up a new directory server for our organization, we'll call it direct.org. I would like to know how you determine which way to name your top level domain. o=direct o=direct.org dc=direct,dc=org Most of the organizations around us use the