Copy the paragraph to an another doc - lesson 2

I need to split the task into 2 functions, because the second function will be used many times if the processing log files.

In GetBiblioFromRTF the paragraphs of document-1 are stored in a global table.

In PasteAtEnd the elements of the array are read and copied/pasted the end of active-2...

If not the first final document (outcomment line 18), the second document becomes active, and therefore, the data is copied to its end.

However, if after completing the global table of closing document-1, the table is empty in each position and nothng is stuck (see warnings).

#target FrameMaker
var gaBibliography= [];                           // keep bibliography lines from processed RTF
GetBiblioFromRTF ();

PasteAtEnd();

function GetBiblioFromRTF () {
  var nBib = 0, newDoc, pgf, pgf1, tRange;
  newDoc = app.ActiveDoc;
  pgf = newDoc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;
// --- read the bibliography into the global array
  while(pgf.ObjectValid()) {                      // until end of doc - take whole paragraphs
    nBib += 1;                                    // count biblio paragraphs for later use in message
    gaBibliography.push(pgf);                     // place the paragraph
    pgf = pgf.NextPgfInFlow;
alert (GetText (gaBibliography[nBib-1], newDoc)); // => expected text
  }
  newDoc.Close (Constants.FF_CLOSE_MODIFIED);     // source document
} // --- end GetBiblioFromRTF

function PasteAtEnd () {
  var j, jMax, oDoc, lastPgf, pgf, textLoc, tRange;
  jMax = gaBibliography.length;
  if (app.ActiveDoc.ObjectValid()) {              // target document
    oDoc = app.ActiveDoc;
  } else {
    Alert ("No active document!");
    return;
  }
  lastPgf = oDoc.MainFlowInDoc.FirstTextFrameInFlow.LastPgf;
  pgf = oDoc.NewSeriesPgf (lastPgf);              // Add a new paragraph at end of flow
  tRange = new TextRange;

  for (j = 0; j < jMax; j += 1) {
    pgf1 = gaBibliography[j];                     // is object paragraph 
alert (GetText (gaBibliography[j], oDoc));        // => nothing
    tRange.beg.obj = pgf1;                        // select it
    tRange.beg.offset = 0;
    tRange.end.obj = pgf1;
    tRange.end.offset = Constants.FV_OBJ_END_OFFSET;
    oDoc.TextSelection = tRange; 
    PushClipboard ();
    oDoc.Copy (0);                                // copy selection to clipboard not interactive
    textLoc = new TextLoc (pgf, 0);  
    textRange = new TextRange (textLoc, textLoc);
    oDoc.TextSelection = textRange;               // set TextSelection to insertion point
  
    oDoc.Paste ();                                // "replace" TextSelection
    PopClipboard ();
  }
}

function GetText (textObj, doc) {
  var text = "", textItems;
  if (textObj.constructor.name !== "TextRange") { // Get a list of the strings in the text object or text range
    var textItems = textObj.GetText(Constants.FTI_String);
  } else {
    textItems = doc.GetTextForRange(textObj, Constants.FTI_String);
  }
  for (var i = 0; i < textItems.len; i += 1) {    // Concatenate the strings
    text += (textItems[i].sdata);
  }
  return text;                                    // Return the text
} // --- end GetText

There seems to be a link "hidden" between the elements of the array and the first document, which of course will be broken, if it is closed. I thought to have all the stuff in the table which is necessary for phase II.

Can anyone give me a tip how to get this working correctly?

Hi Klaus,

the simlest is to avoid 'acticeDoc '.

Why do you not use sth. as:

myOldDoc = open (fileNameOldDoc, openParams, openReturnParams);

myNewDoc = open (fileNameNewDoc, openParams, openReturnParams);

And not to close one of the until the script is finished. Otherwise the ID's of the paragraphs get lost.

BTW: Are you in Darmstadt this week? http://Tagungen.tekom.de/F15/StartSeite/

Then we could meet!

Tags: Adobe FrameMaker

Similar Questions

  • Thunderbird accounts disappeared after having copied the .thunderbird folder in another folder for backup (always went after the removal of duplicates)

    Hello

    I copied the .thunderbird folder to another folder on my computer (Ubuntu on Dell Laptop) for back up, re-open Thunderbird: accounts all parties; asking me to set up an e-mail account. I deleted the duplicate folder, but Auditors have always disappeared when I restart (.thunderbird original file still in the original location).

    I tried to use the profile to find/reactivate Manager profile as suggested on the support page (creating a profile with my name instead of the random.default profile) online - but it did not work.

    I'm reasonably computer literate but not a developer/programmer normal language would be appreciated!

    Thank you.
    Adrian

    It me - confused things fixed which happened, but fortunately I have lay profile .default right in the end!

  • Can I copy the recovery files to another partition D?

    Hello

    My drive came with C and D partitions, but I want to organize my partitions of different drive from the factory.
    I want to slightly reduce the system (C) partition, create a partition to 15 GB, copy the files from recovery to there (to keep the recovery files isolated) and rename this partition as the new D drive.
    The only thing that matters for the tool recovery work is to place the files on a partition of D?
    Has anyone done a thing?
    Will it work?

    Hey,.

    To be honest I have don t think that HDD recovery works if you copy the files to another partition.
    Why you want to do this?

    I use the factory form C: and D: partition by default. On C:, I installed all my programs and on drive D: I saved my files private photo, music, videos, Documents, etc.

    I don't see any reason to create a separate partition for HARD drive recovery files because they are saved in an additional folder.

  • Copy the default value from another field in the same page

    Hello

    I need to pass a value from one page to another page and I want to use this key as DEFAULT VALUE for a field.

    If I create a form tabular all it's ok, but if I create a normal page. I am not able to do that.

    1. 1. I call the page and I pass the value. I also have a FIELD of VIEW and I can see the correct value.
    2. 2. I create a field with attributes of this:
      1. a. source > Source = database column type
      2. b. sources > Source value or expression = FK_ID_DA (the column name)
      3. c. default > default = P27_PK_ID_DA (the field that contains the value)
    3. 3. on the screen, I see P27_PK_ID_DA and not the value

    Where is the error?

    Thank you very much

    TexasApexDeveloper wrote:

    You missed one: before the variable, without it, the default value is the string...

    Not sure that you can READ the other pages... Such that if you are on Page 27 and have a field that you want to use on page 30, page 27 is presented and its items in session state, you can 'see' on page 30.

    So, if you set the default value: P27_PK_ID_DA, then you should get by default, you are looking for...

    Only if the default value Type is set on the PL/SQL Expression. If the literal value "P27_PK_ID_DA" is seen then the Type of default value should currently be set static text with Substitutions of State of Session, in which case the value of session state must be referenced using the syntax of substitution string:

    &P27_PK_ID_DA.

  • Can I copy the image adjustments in another image if I didn't not use layer styles and adjustment layers in Photoshop?

    I have several photos captured in similar conditions and have already adjusted one of the photos for my taste. I am a complete newbie and have just read layer styles and adjustment layers and did not them you use while editing. I simply clicked on the Image > adjustments and went from there. Would be really nice if there was a way I could 'redo' these adjustments on the other photos that I stupidly forgot precise adjustments I made. Is this possible? I use Photoshop CC 2014.

    Sorry but no, this is not possible. It was possible, if you had used adjustment layers instead of making the adjustment directly on the image.

    Using adjustment layers is the best way forward: it is non-destructive; It can always be changed later or even completely deleted, and he has a mask that allows you to restrict the adjustment on the only parts of the image. And it can be saved for later reuse...

  • How to copy the database using rman file from another location.

    You can clone data base using the files of rman backup from somewhere else (on the server to clone).

    I have two server db source and clone db server.
    I normally copy the files of RMAN backup to clone server (under the same folder structure, as it was on the source server).

    The purpose of the test, IE I don't have same partition and free space on the source server and the clone.

    I usually use under notes to the clone.
    http://trysellit.com/hosting/Ttrail/Fajr.php?doc=wtrail & ND = 0556200

    I would try to explain for example again.
    In source server, my rman backup are stored in / U01 and clone server, I copied the files of rman /u04. What step I should take to clone to work anywhere else?

    Using Oracle 10 g on Linux RedHat.

    sape007 wrote:
    Thanks Ken & PrafullaNath.

    BUT my question is: how to transport .dbf files in another place on the clone (I already do).

    Rather:
    The clone is on another server. How to restore by copying the RMAN files from another location on the clone. Please read description above in its entirety.

    Sorry for not being clear.

    Please see my video tutorial. In this tutorial that I take backup of the database, copy the backup to the different server and perform a recovery disaster

  • Accounts missing after copying (and then remove the copy of the) folder .thunderbird to another folder for backup (remains of original file)

    I copied the folder .thunderbird to another folder on my computer (Ubuntu on Dell Laptop) for backup, when I re-opened Thunderbird my accounts appear missing and it asks if I want to configure e-mail, etc. Then I deleted the file in double .thuderbird, hoping that this would fix it. On opening of Thunderbird, it is always as if it were a new installation - .thunderbird folder and files kept at the original location

    I am hoping there is a simple solution.

    Any ideas? - and yes I looked at a lot of books online!

    It me - confused things fixed which happened, but fortunately I have lay profile .default right in the end!

  • v13.0.3.495 - cannot change the tab stops in the paragraph Designer

    Don't know whether or not it was a problem in recent versions (haven't adjusted the tab stops in a while).

    I have a paragraph format with:

    -First = 0.25 "

    GCH - 0.5 "

    -Tab stop = 0.375 "L

    I tried to change the tab stop on a 0.5 "W, went into the designer of paragraph, under the direction of tab stops, changed the value, you click on continue.

    Paragraph designer reappeared, stop tab value appeared as 0.5 "L for a while, and then returned to 0.375".

    No idea why this is happening or how to fix?

    Thank you.

    I had almost the same problem (also FM 13.03.495) a few weeks ago. I tried to change a tab stop from left to right, aligned. If I remember correctly, I clicked on apply in the paragraph Designer, and then the tab stop setting is returned to its original state.

    I have not noticed that in a single file. Since I couldn't reproduce this with other files, I ignored this problem. I think I've changed this tab stop in another file and copy the paragraph format in the problematic file.

  • Copy the table data (including images) of InDesign to Excel (or other formats such as RTF)

    Hello

    We have a problem trying to get data to InDesign to Excel.

    He has this price list in InDesign, with images and small "icons" (also images) that indicate which element appears under the main image for each row in the table. Each line of 'table' can contain a number of elements, separated by return cart + line break or a similar combination.

    The problem is that we can't get good data and images appear in any other editable format. Copy and paste directly into Excel was still the most successful, but here the images are lost. Export to PDF and Acrobat Pro, exporting to other formats always seem to fail in a way or another (paintings take place on top of the other, images and so on, has lost different for the different export formats).

    Untitled-1.jpg

    Data copied to OpenOffice Calc (and then saved as a file in excel format). Yellow areas added to show where the images were in InDesign.

    Price a bit blurred in the picture showing above.

    Are there good ideas how to copy the InDesign table to another editable format (which requires no licenses Adobe...)?

    Thank you

    Andreas

    I didn't notice the direct export from InDesign to RTF. You had to put the cursor within the story make this option appear!

    It is really good, and I sent the result to those who will use it, for them to check if she's good enough and if they can take for excel or work with him in the RTF format as is.

    Thanks a lot for pointing out this option!

  • Insert a blank space in the paragraph style?

    Is it possible to integrate a white space inserted (en character) in a paragraph style?

    I created a paragraph to chapter headings style. Chapter and number are centered horizontally on the page with a thick end line (key) on each side - a little like that, except that I use the dashboard to create the line in this example:

    -------------------------------------  Chapter 2  ------------------------------------

    Inserted white spaces before and after 'Chapter 2'.  However, when I try to apply the paragraph style to another title, the spaces are not there.

    (Line thin thickness was created as text underscore and the offset is vertically centered with the text.  It would make a difference if I created the thick end line in the form of a graph?)

    Oh and I also tried to create an object style, but it does not recognize spaces, either.  I know that something will work, but little by little learning has not met yet the solution.

    Thank you.

    Do it like this:

    1 make the high line a paragraph above net. Assign the 'Column' width (full) and set its vertical offset in right position.

    2. Add a paragraph below NET. Together, this upright even shifted, but makes a little (or a lot) more thick. Set its color [Book]. Set the width of 'Text', not 'column '. Then set the negative value of the width approx. white space you want on the left and right - something like 'mm-2' the left indent and right.

    3. you're done!

  • How can I copy the format of a sentence or paragraph on another phrase or a paragraph?

    When I copy and paste a section of an article to another, I want to change the format of the section imported to accompany the rest of the article. In Outlook or MS customer, I would use the brush for this icon. How can I copy the format of a section in Thunderbird in another section?

    Thank you very much.

    I would like to use stationery to say my favorite styles, then use 'Paste without shaped' to allow the formatting that is currently in force to apply to the text pasted, not knowing everything already set the imported text. A weakness of Thunderbird in its native form, is that it tends to forget to insert your policy chosen by default etc.. The add-on stationery that heals by making your explicit requirement.

    Messages sent by users of Thunderbird often appear ugly serif text (IMHO), what is lacking Outlook, Thunderbird forgets to say that you have chosen a sans serif font when composing.

    Without stationery, all your efforts to align your text can come were reduced to nothingness.

  • How to copy the message filters for an email to another account email account

    have a filter of msg in a single email counts with many entries - how to copy this msg filter to another account

    If you want to duplicate a filters of accounts to another account, you don't need to create them again. Output of Thunderbird and copy the file "msgFilterRules.dat" instead. If the account is in a different profile and it uses custom headers, you will also need to copy the parameter mailnews.customHeaders to prefs.js.

  • Another reason to hate the Photos app. I want to put titles on the photos that I put in an album to share with others. I can add titles on my MacBook, but not on my iPad Air. I tried to copy the photos from my MacBook to the iPad, but the titles have disa

    Another reason to hate the Photo App. I want to put titles on my photos in an album to explain what are the images. I can do this on my MacBook, but not on my iPad Air. I tried to copy the album (by airdrop) to my iPad, but the titles disappear. Any suggestions?

    Since the Photos of OSX application, select an image (once it's in an album, not in Moments) and you can add a comment that is visible in the Photos of iOS.

  • List of exceptions of the cookie - how you save, copy and reload it to another instance of Firefox on a machine tour?

    List of exceptions of the cookie - how you save, copy and reload it to another Firefox instance on a different machine? What is the name of the file/s used?
    I need to upgrade the machines regularly and waver not to have to retype all those addresses cookie blocked in each new instance of Firefox.

    The file "permissions.sqlite" stores exceptions 'allow' and 'block' for cookies, images, pop-up windows and installation of extensions (software).

  • How to copy the numbers in a cell to another cell and gets their total

    500.40

    192932.90

    231838 * 90

    290414 * 15

    222312 * 15

    222314 * 5

    141722 * 20

    Hello, can I ask how to copy the numbers after the period/asterisk to another cell and then add up all the numbers copied without having to type them.thank you

    Hi mirijin,

    Break the problem into small steps:

    Step 1. All separators (periods and asterisks) convert the asterisks.

    Formula in B2 (fill down)

    = SUBSTITUTE(A2,".","*")

    Step 2. Find the position of an asterisk in each cell.

    Formula in C2 (fill down)

    = FIND("*",B2)

    Step 3. Extract everything to the right of the asterisk.

    Formula in D2 (fill down)

    = RIGHT (B2, LEN (B2) −C2)

    Step 4. Convert the text to numbers re using the VALUE function.

    Formula in E2 (fill down)

    VALUE = (D2)

    This table has a header row and footer of the line, so the SUM in E9 apply to all cells in the body.

    = SUM (E)

    You can combine the individual forms in a unique and complex formula, or simply to hide intermediate columns B, C and D:

    Kind regards

    Ian.

Maybe you are looking for