Work out paragraphs in two successive loops while

Dear experts,
In the wake of "How to set the offset for a textrange (after a TAB)?", I have implemented the code snippet in the existing flow script (simplefied for the presentation here):

  • Read a RTF which contains two parts of paragraphs by tabs. See the file FM-biblio-collected - test.fm.
    This package contains 4 points in the first part and 3 points in the second half.
  • PGF in the first part of reading works perfectly. These all begin with [[(script lignes 10... 26)]
  • The first TFP of the second part (paragraph number 5) is already read, closing the first loop due to lack of [[at the beginning.
  • Further processing of this paragraph (script lines 27... 35) reveals that the only section not 5, but paragraph 1 is treated! (textrange in line 41 is posted to 21 votes against 22, that installs only on the first paragraph!)
  • Of course this brings us to the message on line 43

Why don't line 29 takes the same paragraph (paragraph 5) object like it was properly taken into account in the previous last object like?

// Have the expanded RTF file (FM-biblio-collected-test.fm) open 

#target framemaker  
  
var goRtfDoc = app.ActiveDoc;  
var pgf = goRtfDoc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;  // get first pgf in flow
var TAB = String.fromCharCode(8);               // FM has wrong ASCI for TAB
var tabRange

// --- read the temp/formatted citations --- "formatted" consist of the reference number only
  while (pgf.ObjectValid()) {
    pgfText = GetText (pgf, goRtfDoc);
    if (pgfText.substring (0,2) === "[[") {       // citation lines start with [[
      parts = pgfText.split(TAB);                 // get the two parts of the line
      parts[0] = parts[0].replace("[[", "{");     // replace [[...]] by {...} for find in user doc
      parts[0] = parts[0].replace("]]", "}");
      if (parts[1].substring (0,1) === "{") {     // this placeholder is unresolved, skip it
        nUnres += 1;
        pgf = pgf.NextPgfInFlow;
        continue;
      }
//    gasFmtCitsRaw.push (parts[0]);              // store the placeholder citation
//    gasFmtCitsFmt.push (parts[1]);              // store the formatted citation (just a number)
      pgf = pgf.NextPgfInFlow;
    } else { break }                              // first line of bibliography encountered
  }
// --- read the bibliography paragraphs
  while (pgf.ObjectValid()) {                     // until end of doc
    tabRange = GetTabRange (pgf, goRtfDoc);       // Get the text range starting after the TAB to the end of the paragraph.  
//  gaoBibliography.push(tabRange);               // store the paragraph-part in the array
    goRtfDoc.TextSelection = tabRange;      // for later use in tests
    goRtfDoc.Copy (0);                      // Check manually what can be copied
    alert ("are we OK?");
    pgf = pgf.NextPgfInFlow;
  }

function GetTabRange (pgf, doc) {  
  var textLoc, textRange, findParams, tabRange;  
  textLoc = new TextLoc (pgf, 0);                 // Make a text location at the beginning of the paragraph. 
  findParams = GetFindParams ("\x08");            // Get the find parameters for finding a tab.  
  textRange = doc.Find (textLoc, findParams);     // Search for the string.  
  if (textRange.beg.obj.ObjectValid ()) {         // See if the tab was found.  
    alert (textRange.beg.obj.Unique + "    " + pgf.Unique);   //?? Is <> if cursor is not at start of pgf. 
    if (textRange.beg.obj.Unique === pgf.Unique) {// Make sure the tab is in the correct paragraph. 
      // Select the text from after the tab up to the end of the paragraph.  
      tabRange = new TextRange (new TextLoc (pgf, textRange.beg.offset+1), new TextLoc (pgf, Constants.FV_OBJ_END_OFFSET - 1));  
      return tabRange;                            // Return the text range. 
    }  
  }  
  return 0;                                       // TAB Not found
}  
  
function GetFindParams (string) {  
  var findParams = AllocatePropVals (1);  
  findParams[0].propIdent.num = Constants.FS_FindText;  
  findParams[0].propVal.valType = Constants.FT_String;  
  findParams[0].propVal.sval = string;  
  return findParams;  
} // --- end of GetFindParams
  
function GetText (textObj, doc) {
  var j, 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 j = 0; j < textItems.len; j += 1) {    // Concatenate the strings
    text += (textItems[j].sdata);
  }
  return text;                                    // Return the text
} // --- end GetText

All ideas are welcome

Klaus stew

Klaus,

I can't explain the behavior that you see, as it appears that textLoc is ignored in line 41:

textRange = doc. Find (textLoc, findParams);

I don't know if it's a bug, or what is the problem. However, I have found a possible workaround. I added the following lines just before the line 41, in order to force the insertion until the beginning of the current paragraph:

var searchStart = new TextRange (new TextLoc(pgf,0), new TextLoc (BMP, 0));

doc. TextSelection = searchStart;

.. like in:


function GetTabRange (pgf, doc) {    

var textLoc, textRange, findParams, tabRange;    

textLoc = new TextLoc (pgf, 0);
// Make a text location at the beginning of the paragraph.   

findParams = GetFindParams ("\x08");
// Get the find parameters for finding a tab.    

var searchStart = new TextRange (new TextLoc (pgf,0), new TextLoc (pgf, 0));    

doc.TextSelection = searchStart;

textRange = doc.Find (textLoc, findParams);
// Search for the string.    

if (textRange.beg.obj.ObjectValid ()) {
// See if the tab was found.    

alert (textRange.beg.obj.Unique + "
" + pgf.Unique);   //?? Is <> if cursor is not at start of pgf.   

if (textRange.beg.obj.Unique === pgf.Unique) {// Make sure the tab is in the correct paragraph.   

// Select the text from after the tab up to the end of the paragraph.    

tabRange = new TextRange (new TextLoc (pgf, textRange.beg.offset+1), new TextLoc (pgf, Constants.FV_OBJ_END_OFFSET - 1));    

return tabRange;
// Return the text range.   

}    

}    

return 0;
// TAB Not found  

}

After that, the behavior of the script seems to match what you want. I hope this helps some. In addition, the code example looks like all crazy in my browser editor, don't know how it will appear when I click Add response.

Russ

Tags: Adobe FrameMaker

Similar Questions

  • How to create a chart using two independent loops while?

    Hello world

    I'm currently developing a program for the acquisition of data. In this program, I have two independent, while loops that each output a number of type double with each iteration of the loop. I am able to successfully create two independent waveform graphs (data / time) for each of the loops when placed inside. However, I now want to create a live data xy chart (the output of a loop is x and the output of the other is there).

    I have a problem, that the distinct nature of loops... When I try to extract data outside of the loop (naturally), it is not refresh with each iteration of the loop causing the graph xy does not work in the way I intend. Is there an easy way to solve this problem? If more clarification is needed, please let me know!

    David

    If the two loops are not synchronized, exactly how do you do the xy graph, where each point, by definition, must have a value of each loop.

    1. updated when updates or the other value and combine with the last value from the other loop?
    2. updated on a constant basis with the current value of each loop?
    3. ... There are many other possibilities.

    #2 is the easiest. Simply create a third loop with a reasonable time and graph the two values via local variables. You probably also should limit the history of ranking somehow.

  • How to upgrade a shift with two independent loops while register?

    Hello everyone, I have a panel with two clusters with indicators control... a left and a right. I have messages from serial port, and I'm currently updating the left and the right within their own while loops. I have a single variable, which must be updated based on updates on both sides. Basically, I need follow the last selection update on each side... If I had 1, 2 and 4 on the left side and 3 on the right side... I would need to follow 4 was the latest updated the register shift variable for uses more in my vi. Can someone give me an idea how to upgrade this a variable based on two while loops that run independently in the same sequence context? Thanks in advance, cayenne

    Thank you both of you for the suggestion.

    I managed to find a way to get the values that I needed without EI... but I read the link to the Nugget in their subject, and I can't expect a use for them in the future.

    Cayenne

  • How can I change my default save HDD to my FAVORITES and DESKTOP files (I want to always work out laptop for these two files)?

    I travel a lot and always had problems with what files and update my portable media player. Finally, I feel I have the solution and until now it works fine except for two files. I have only about 8 files/important things I work on quite regular, then now, I set up the files on my laptop and managed to get them to be the main 'saved' from my office. In this way, when I go, all I need to do is to make a back-up of EXACTLY what is on my laptop and here I am. [I used to work on my desktop and I must then transfer the files to my laptop when I would need to travel, but inadvertently, is I would like to work on a file on my desktop before I left (but after the transfer) and when I got home from my trip that I would not forget to transfer the portable desktop files but would open and work on a desktop file before realizing that I] did not transfer.  So it would be a nightmare to have to compare each file to copy / paste new entries of the desktop and laptop to get a REAL current, updated file. Now I am working just on the laptop at work, and then on a trip (just have to make backups of a 8 files). My only two problems are that for the life of me, I can't find how to have FAVORITES and save on the laptop instead of the OFFICE desktop computer. Please tell me step by step how I do drive (portable) M be my default save to FAVORITES, and OFFICE to make the perfect solution for my high travels. Thank you

    you could try synctoy from microsoft:

    http://www.Microsoft.com/downloads/en/details.aspx?FamilyId=C26EFA36-98E0-4EE9-A7C5-98D0592D8C52&displaylang=en

    DB·´¯'·.. ¸ >-))) º > ·´¯'·.. ¸ >-))) º > share nirvana mann

  • File sharing works is not between two computers Windows 7 Home Premium on a work network.

    Desktop computer is connected to a hub that is connected to a wireless router.

    Laptop connects via the wireless router.

    Both computers are in the same workgroup.

    Two computers indicate that they are in the same network of 'work '.

    The two computers 'see' each other.

    Both computers have the same advanced sharing settings:

    • Turn on network discovery
    • Open file and printer sharing
    • Turn on public folder sharing
    • Streaming media is off
    • Use 128-bit encryption
    • Turn on password protected sharing
    • Homegroup connection is not used, but is set to 'use user accounts and passwords'.

    As I try to get the laptop to connect to a share on the desktop computer, the user accounts and passwords on the desktop include the user account and the password for the laptop. This is an administrator account.

    There are actions on the desktop computer and these actions include the credentials of the user of the laptop computer with read/write access.

    Or machines is now faced with my right. I know one of them use AVG Free, but I'm not sure what the other computer uses for antivirus.

    I get the error message has to do with the user account that I use is not eligible not by office machine. I'll post the exact message when I am in front of the computers within a few hours.

    Sharing files between the two had worked, but then stopped. When you first install file sharing, that I had run into a different problem on the desktop where all settings indicated should be shared, but clicking on through a screen I got a message that file and print sharing has been disabled and I want to turn it on? (even while fixing in advance sharing settings says he was turned on...)

    Any ideas? I'm pulling out my hair. Thank you!

    Steve Woodward

    Seem firewall windows are playing games with you, try disabling it to see if it will work.

  • How to start and stop two parallel loops?

    Hello

    I want to control two parallel loops with different timing in a vi. Second, it means that to start the loop 1, roll 2, stop 1 or 2 restart loop 1...

    But if loop 1 turns that I can't start looping two then reverse.

    Can someone help me and show what is bad in my example?

    Thank you

    Christian

    Hello Christian,.

    The reason why you can't do what you want is actually quite simple.

    You have an external loop which is 'on' the two inner loops.

    So when you stop one of the inner loops, the outer loop will still be in the same iteration until the other inner loop ends - stop the other inner loop.

    You can see very easily if you explore the outer loop iteration count - only when both loops internal, it is incerment.

    So, to do what you want, you need to make them independent - you need two external loops.

    Check my attachtment, see if that's what you need.

    Hope this helps,

    Paulo

  • Using the MF and the "open a new tab" + sign opens a new page with a list of site visited recently, which is a very useful tool. It works fine on my two desktop computers, but

    Using the MF and the "open a new tab" + sign opens a new page with a list of site visited recently, which is a very useful tool. It works fine on my two desktop computers, but I can't it to work on the laptop.

    I downloaded "New tab Pro" on the laptop (do not even see on desktop computers so don't think about) such that she was like the real deal but nope... do not work. Running the latest version of MF, ideas on how activate it please?

    Thank you guys are going to mark as 'resolved' BTW it is no "folder on the desktop named old data from Firefox. Hmmmmmm.

  • Tecra R940 - 1 hr: what happens to work out of the box with Linux?

    I'm considering buying a laptop Tecra R940 - 1 hr.
    I'm going to use it with linux (ubuntu) system.

    What happens to work out of the box?
    Should I expect any problems with the display/network/wifi/sound?
    What about camera, usb 3.0 and bt?

    What is possible to work? Suspend? Function keys? Fingerprint reader? SD reader?

    What's not to work?

    I run Ubuntu Studio (12.04) on a Tecra A11-ST3504, and everything works perfectly.

    However, your computer probably has the latest UEFI instead of the BIOS, and this causes problems for some with start-up and installation.

    If the live system starts and runs, I'd go for it.

    I'll put the admins the trouble to make their usual warning: "of course, Linux is not supported by Toshiba."

    Enjoy!

  • How can I measure the time between each two successive increase edges, using digital input?

    Hello

    I have tried two measure the time in seconds between each two successive rising edges on a digital input.

    So far I managed to detect the rising edge, increment a counter at each rising edge and take the time during which the increase is edge

    all I need now is subtract edge currently rising from the previous era of edge rising to calculate (T), which can be 1/frequency and display in real time for the user.

    but I do not know how to do this

    Can someone help me please!

    Woah!

    Sorry Apok, but your code becomes much too complicated and salty. I don't think that all records to offset or Boolean conversion/operators are necessary at all.

    If you want to measure the time between two keys so it's another (much less complicated) way. It simply records the time when press button in a registry change, then compares the two.

  • Baseline of the connection Loop While

    Hello

    As in the photo below, I have reference DB connection. "Properties of connection 2" indicator displays the correct values, the same 'Properties of the connection' indicator loop while shows nothing, but the connection numbers are the same (in the probe). Structure of the event in this while loop also if it is important. Why I can't get a correct connection of while loop reference?

    I use LV2011.

    Kind regards

    Kacper


  • The camera is on the way of selfie and I can't work out what to press to change it, I can't take normal peaks facing outwards.

    Original title: camera acer

    Just got an Acer Tablet. The camera is on the way of selfie and I can't work out what to press to change it, I can't take normal peaks facing outwards. Help is greatly appreciated.

    Hello

    Go to http://us.acer.com/ac/en/US/content/support to find and download the manual for your tablet.

    Don

  • now my restoration of the work system - properties - show two drives C: and D: WHY? I want to only show him C: _

    Hi I noticed recently that now my restoration of the work system - properties - show two drives C: and D: WHY?  I want to only show C:

    He has never done this before and I don't want to show him D: at all, I have a HP and the D: drive is my restore disc, with D: listed means that he could get crushed and I don't want to appear in the recovery menu.

    How can I delete the D: drive on the recovery menu but the C: DRIVE ON leave...

    Thank you

    Hi I noticed recently that now my restoration of the work system - properties - show two drives C: and D: WHY?  I want to only show C:

    He has never done this before and I don't want to show him D: at all, I have a HP and the D: drive is my restore disc, with D: listed means that he could get crushed and I don't want to appear in the recovery menu.

    How can I delete the D: drive on the recovery menu but the C: DRIVE ON leave...

    Thank you

    With all due respect, you are incorrect. You simply did not notice before D drive. D drive is a logical drive. To the best of my knowledge there is no way to prevent it from the show. However, simply disable the system for D drive restore.
    I do not vote for me I'm not here for points. If this post helps you, vote. Visit my forum @ http://repairbotsonline.com/

  • Computer is stuck in a reboot loop, while security updats

    ORIGINAL TITLE: reboot problem

    Computer is stuck in a reboot loop, while security updats

    Hello

    1 were there any hardware or software changes made on the computer before this problem?

    2. do you get an error message or an error code? If Yes, what is the exact full error message?

    I would suggest trying the following methods and check if it helps.

    Method 1: Try to run the system in safe mode restore.

    Step 1:
    Try to start the computer in safe mode, here is the link:
    http://Windows.Microsoft.com/en-us/Windows-Vista/start-your-computer-in-safe-mode

    Step 2:
    Once you start the computer in safe mode, try to perform the system restore and check that if it helps, here is the link:
    http://Windows.Microsoft.com/en-us/Windows-Vista/system-restore-frequently-asked-questions

    What are the system recovery options in Windows Vista?

    http://Windows.Microsoft.com/en-us/Windows-Vista/what-are-the-system-recovery-options-in-Windows-Vista

    If you were able to start your computer normally by using the system restore, then refer to the following method, and try to update your windows.

    Method 2: To help resolve the error and other messages, you can start Windows by using a minimal set of drivers and startup programs. This type of boot is known as a "clean boot". A clean boot helps eliminate software conflicts.

    Note When you perform a clean boot, you may temporarily lose some functionality. When you start the computer as usual, the function returns. However, you may receive the error message, or you can experience the original behavior.

    Note: follow step 7 to reset the computer to start as usual after the boot process.

    http://support.Microsoft.com/kb/929135

    See the following help link.

    Problems with installing updates

    http://Windows.Microsoft.com/en-us/Windows7/troubleshoot-problems-with-installing-updates

    Hope this information helps.

  • I just bought a new HP Envy DV6 and can work out how to open microsoft office.

    I just bought a new HP Envy DV6 and can work out how to open microsoft office.  When I try he asks me a product key of microsoft Office was preinstalled, so I don't have a product key!  Any suggestions?

    What version of Microsoft Office is this?

    If its Office 2010, you can buy a copy from amazon.com/software because Microsoft is no longer at the price of Office 2010.

    If his Office 365/Office 2013, you can sign up for a trial key to:

    http://Office.Microsoft.com/en-us/Home-Premium/

  • Is anyone else having problems with Windows 8 when your typing and e-mail? For some reason, it comes out constantly to the tile screen while I type making me about starting more.

    Is anyone else having problems with Windows 8 when your typing and e-mail? For some reason, it comes out constantly to the tile screen while I type making me about starting more.

    Hi Chaz,

    I thank you for your message and gives us a chance to help you. I see that the Mail app closes while you are typing an email.

    Please answer these questions to get a better understanding of the issue.
    1 have changes made to your computer before this problem?
    2 shut down other applications while they are in use?
    3. do you get an error code?

    You can try these methods to check whether the problem is resolved.

    Method 1: Run the troubleshooter of app.

    http://download.Microsoft.com/download/F/2/4/F24D0C03-4181-4E5B-A23B-5C3A6B5974E3/apps.diagcab

    Open this link to launch the troubleshooter.

    Method 2: Update the application.

    Method 3: Reinstall the application.

    This link has the steps that you can follow to update and reinstall the application.

    http://Windows.Microsoft.com/en-us/Windows-8/what-troubleshoot-problems-app

    Feel free to use the forum for any other issue of Windows, you may have.

Maybe you are looking for

  • Audio separate from a video clip to use separately

    (Via a small list of things I like to do in iMovie HD...) The best I get is that it is not possible within the FCE, you have to do it somewhere else (for example, MPEG Streamclip). Y/N? TIA

  • Problems with iMessage

    I have problems with iMessage. I upgraded my iPod touch 5th generation iOS IOS 7 something 9.3.1. Account was opened to keep Messages forever. All messages are passed after the upgrade. Very well, we will live with the consequences, but would really

  • Clock and battery indicator went

    Hey, I've finally updated to OS X El Capitan last night. Everything goes a lot overall, I love the new features and the whole system runs a lot faster. The only problem I have is that since I've updated the clock and battery indicator are no longer v

  • P7-1054: upgrade ram p7-1054

    Hello I have a p7-1054 computer and it has 6 GB of ram / I want to increase the ram to 8 GB and use both slots of HRD. I'm not sure what ram I can get from amazon that will work can someone let me know which brands work please thank you Here is the l

  • Cannot set up the printer Pixma MG5720 - need drivers for Windows 8.1

    All I get is a screen of disc and the location search.  Forever. 2nd circle of hell.  What can I do? Help. Desperately looking for tips to find and download the drivers and software for printer. My computer is an operating system 64-bit, 64-bit, scre