Quantcast
Channel: Adobe Community : All Content - FrameMaker Scripting
Viewing all 888 articles
Browse latest View live

Convert FM to XML - resolve missing entity references with Structured App

$
0
0

When converting an FM Book using the GUI, there is a prompt that asks the user to chose one of the predfined Structured Application options within a dropdown menu. Once selected, the resulting XML contains two sections after the header information. The first section contains a list of entity references followed by the referenced file. The second section contains a huge tag with all the entitiy references, which look lik &bkc<some number>.

 

I am using the FDK C/C++ route. The script I have only produces the second section and the complete first section is missing. I searched the forums and saw a couple of refences to the following API call -> FS_StructuredSaveApplication().

 

IntT saveDitaIndex = F_ApiGetPropIndex(&saveParams, FS_StructuredSaveApplication);
StringT testString = F_StrCopyString((ConStringT)" ");
saveParams.val[saveDitaIndex].propVal.u.sval = testString;

 

I am still seeing no change in the output. My question is what value(s) should be or can be set for this to work?


Find and Replace Operations on .dita files

$
0
0

Hi All,

I am new to scripting.

But I would have dita maps that point to an absolute destination for each of the xml and dita files and I would like to change these to relative addressing.

I figure that a script might be the right way to do this.

Any alternate suggestions are welcome.

Appreciate it,

Myko

Remove space in fm doc.

$
0
0

how to remove unwanted double spaces and paragraph marks in framemaker document using extendscript ?

Remove spaces in framemaker document.

$
0
0

How to remove unwanted double spaces and paragraph marks in framemaker document using extendscript ?

Remove spaces in framemaker document.

$
0
0

How to remove unwanted double spaces and paragraph marks in framemaker document using extendscript ?

How to connect the postgresql database server using in extendscript?

$
0
0

Hi,

 

I need to connect the postgresql database server via extendscript javascript. So I tried with the following code. But error thrown like 'require is not a function'. So please suggests if any ideas.

 

var pg= require('pg');

var connection = pg.createConnection({ 

  host: '', port: '', user: 'test', 

  password : 'test', database : 'test' 

}); 

connection.connect();

var queryString = "SELECT * FROM 'ExtendScriptTest'"; 

connection.end();

 

Thanks,

Latha

I need to connect the postgresql database server via extendscriptjavascript. So I tried with the following code. But error thrown like 'require is not a function'. So please suggests if any ideas.

Insert paragraph on empty page and add text

$
0
0

Hey guys,

 

I just got the task to insert a certain text on empty pages inside a .fm file (the empty page is always the last page of each file).

I already took a look at how to insert a paragraph (How to insert a new paragraph? ). But that only adds a paragraph right behind the last one. Since I do not have a paragraph on the page that I want to insert the text to, I wonder which element I could use to insert the paragraph right at the beginning of that page. Does anyone have a clue how that could be done?

 

Kind regards, Tom

Run an Fcode through a Hypertext command

$
0
0

Is it possible to execute an Fcode through a Hypertext command? I want to be able to click on a Hypertext link in FrameMaker and have it execute an Fcode. I see this in the FDK Reference on page 800: FV_HypertextFcodeInvalid: Invalid FCode in the hypertext command. But I can't figure out the syntax for doing executing an Fcode in a Hypertext marker. Thanks in advance.


Scripting tips

$
0
0

Hi Scripters, I want to offer some advice to those seeking scripting help. First of all, this forum isn't too busy, but there are some extremely helpful people on here. If you follow this advice, it will make it easier for willing people to help you.

 

One of the most important things you can do when solving a scripting problem is to isolate the problem to the smallest possible unit. For example, if you are solving a problem with tables, don't post code that processes all of the tables in the document. Isolate the code so it just works on the selected table. Or, if you are trying to apply a condition format to paragraphs, don't post all of the code for processing all of the components in a book. Instead, isolate your code to work on a single, selected paragraph. When code is isolated to small units like this, it makes it easier to test and troubleshoot. And when it doesn't work, it makes it easier for other people to stage things on their computers so they can see what is wrong.

 

In general, this is the best way to develop scripting solutions anyway. When your individual "units" are tested and debugged, you can expand the code out to process an entire document or book. As an added benefit, your code becomes more modular and easier to reuse in other scripts. I will try to follow up with some specific code examples so you can see how it works. Please let me know if you have any questions or comments. -Rick Quatro

Framescript: Retrieving text from a broken xref

$
0
0

Hello fellows,

 

I'd like to write a script that will find broken external xrefs and attempt to restore them.  In my case, the xrefs get broken because the xref markers appearing in the source files are often updated by a system that generates these source files. I'd like to restore the xrefs by retrieving the xref string and attempting to find this string in the source files. But here is a problem: when an xref is broken, it no longer allows to retrieve XRefSrcText properly. The xref string no longer appears in XRefSrcText. I used the following code to test that:

 

Set vCurrentDoc = ActiveDoc;

Set vXRef = vCurrentDoc.FirstXRefInDoc;

 

Loop While(vXRef)

If vXRef.XRefIsUnresolved

Write Console  vXRef.XRefSrcText;

 

EndIf

Set vXRef = vXRef.NextXRefInDoc;

EndLoop

 

So, the XRefSrcText of an unresolved xref appears as follows:

25117: TableTitleTable Entry: ;2511718;2511719

 

While the XRefSrcText  of a live xref  appears as follows:

 

41369: TableTitle: Table 329: Item Numbering

 

What I would need to extract from here is the string "Item Numbering" and then find it in the xref source file to create a new link.

 

My question is how can one retrieve the text string from a broken xref? One way I could think of is converting the xrefs to text, copying the relevant part into a variable using regex. Any other ideas?

 

Thank you!

Add textframe in framemaker.

$
0
0

How to add textframe with pagesize in framemaker using extendscript ?

placing/opening an activedoc in a specific location

$
0
0

With Structured FrameMaker, doc files rarely open where I want them to. I was hoping the screenX and screenY properties would do that, but they seem to just modify the frame in the activedoc. I'm tired of dragging files constantly, or un-burying them from beneath the toolbars.

 

In my case I have a really wide screen, so I have a main doc location on the left, my open tool bars in the middle, and then when I need it, I have a second document open on the right. If I can figure it out, I'd like to add some shortcut keys to force the windows to open in one or the other of those places.

 

Any hints?

 

Thanks for any help you can give me!

 

Rick

Delete textframe in framemaker.

$
0
0

How do I delete all text frames in framemaker using extendscript ?

Select textframe in framemaker.

$
0
0

How do I select all text frames in framemaker using extendscript ?

Hidden Table Properies

$
0
0

Hi All,

 

I have probably asked this question before, but the issue has come up again. When you insert a table in FrameMaker, there are "default" paragraph formats for each column in Header, Body, and Footer rows in the table. In the MIF TblCatalog, they look like this:

 

...<TblCatalog <TblFormat   <TblTag `Format A'>  <TblColumn    <TblColumnNum 0>   <TblColumnWidth  1.0">   <TblColumnH     <PgfTag `CB_CellHeading'>   > # end of TblColumnH   <TblColumnBody     <PgfTag `CB_CellBody'>   > # end of TblColumnBody
...

 

You can see them in the <PgfTag entries in this snippet. Are these properties exposed anywhere in the FDK? I don't think they are, but if not, I wonder why? It sure would be handy to be able to change them programmatically. Thanks in advance.

 

Rick


Align textframe in framemaker.

$
0
0

Hi,

     How to move textframe from top to bottom of framemaker page using textframe "Align" property in extendscript ? And i have attached screenshot for included textframe in top of framemaker ,and i have mentioned "Align" property.I need textframe move into bottom.So please suggests if any ideas.

To display top and bottom page in framemaker.

$
0
0

How to display top and bottom view in individual page using textframe with zoom for framemaker using extendscript ?

Highlight the top and bottom view in framemaker document page.

$
0
0

Hi ,

     I am trying this below code.First split all pages in framemaker document . And first time click the button to highlight top view using zoom condition within textframe ,and second time click the button to display the bottom view with zoom condition within textframe ,and same as all the pages in framemaker document.This is my task.Now i had complete, till split the pages in framemaker document.I need to display top view and bottom view using zoom within textframe.So please suggests if any ideas.

var oDoc = app.ActiveDoc;

var textFrame;

var   tempValue = 0;

var buttonWindow = new Window ("palette", "Textframe");

var b= buttonWindow.add ("button", undefined, {style: "toolbutton"});

b.text = "Add textframe";

b.onClick = function (){

      tempValue = tempValue + 1;

      AddTextFrame(oDoc, tempValue);

     }

buttonWindow.show();

  function AddTextFrame(oDoc, tempValue) {

  firstRef = oDoc.FirstBodyPageInDoc;

        var count = 0;

        while (firstRef.ObjectValid()) {

            if (count != 0) {

                  textFrame = oDoc.NewTextFrame (firstRef.PageFrame);

                  textFrame.Width = oDoc.PageWidth; 

                  textFrame.Height = oDoc.PageHeight/2; 

                  var topPage=textFrame.Height;

                 // textFrame.Delete();

                  oDoc.Zoom=1.2*65536;

 

                  var  textFrame1 = oDoc.NewTextFrame (firstRef.PageFrame);

                  textFrame1.Width = oDoc.PageWidth; 

                  textFrame1.Height = oDoc.PageHeight/2; 

                  textFrame1.LocY =(oDoc.PageHeight) - (textFrame1.Height);

                  oDoc.Zoom=1.2*65536;

                  var bottomPage=  textFrame1.LocY;                 

                  }

                   firstRef = firstRef.PageNext;

                   oDoc.CurrentPage = firstRef;

                }

            count++;

            if (count == tempValue) {

              break;

              }

        }

Check string contains values.

$
0
0

Hi,

 

How to check whether a string contains the specified values in extendscript for framemaker ?How to use in following code using extendscript for    framemaker ?

    var str = "Hello world, welcome to the universe.";

    var n = str.includes("world");

app.Displaying considered unreliable

$
0
0

Der friends,

The white document hits again... ( see https://forums.adobe.com/thread/2276988) and I tracked it down to failing app.Displaying. The script requests function SetDisplay (bWanted) 17 times successful, but the 18. call does not switch the display any more. The routine is that simple:

function SetDisplay (bWanted) { //=== Set display to on or off ====================================
// Arguments bWanted: true => set display ON; false => display OFF
// Commment  This function does not work reliably. See https://forums.adobe.com/thread/2276988
// Reference Rick Quattro    Console ("    current:" + app.Displaying + " => wanted: " + bWanted);  if (app.Displaying != bWanted) {    app.Displaying = bWanted;    Console ("    set ? " + app.Displaying);  }
} //--- end SetDisplay

Just after the following log the document gets white:

....SetDisplay(true)    current:0 => wanted: true    set ? 0

That is, app.Displaying was not performed and hence the document is not visible.

The white document appears within a routine which collects variables from the document. Since this function switches between pages and even page types I want to avoid flicker - which is really annoying here.

 

Do you spot something dubious in this routine?

 

function CollectVarsInDoc (oDoc, aDocVars) { //=== Collect variables in the 'natural' order =======
// Arguments oDoc:        current document
//           aDocVars:    array to be filled with var objects
// Called by xxx
// Calling   GetFindParameters, SetDisplay, SaveCurrentLocation, RestoreLocation
// Comment   Variables are found on all page types (Body, Master, Reference). 
//           Starting points must be oDoc.FirstBodyPageInDoc, .FirstMasterPageInDoc, .FirstRefPageInDoc
var aVarsRange = [], bIsSystem, findParams, jFound = 0, jPageType, iVrLen, oFirst, oPage, oPara,     oSavedLoc, oTextItem,  oTR = new TextRange(), oVar, sVarName, sValue,    aPages = [oDoc.FirstBodyPageInDoc, oDoc.FirstMasterPageInDoc, oDoc.FirstRefPageInDoc];  SetDisplay (false);  oSavedLoc = SaveCurrentLocation (oDoc);  aDocVars.length = 0;                            // clear array for refill  if (oDoc == null) {                             // emergency bailing out        SetDisplay (true);    return;  }                 for (jPageType = 0; jPageType < 3; jPageType++) { // for all page types    oFirst = aPages[jPageType];    if (oFirst.id == 0 && jPageType != 1) {continue}; // only master page(s) exist     oDoc.CurrentPage = oFirst;    oPage = oDoc.CurrentPage;    oPara = oPage.PageFrame.FirstGraphicInFrame.FirstPgf;    while (oPara == undefined) {                  // can happen on ref pages      oPage = oPage.PageNext;      if (oPage.id == 0) {        goFMv.nDocVars = aDocVars.length;        RestoreLocation (oDoc, oSavedLoc);        SetDisplay (true);        return;}                                  // no next page available      oPara = oPage.PageFrame.FirstGraphicInFrame.FirstPgf;    }    oTR   = oDoc.TextSelection;    oTR.beg.obj =  oTR.end.obj = oPara;    oDoc.TextSelection = oTR;    oTR.beg.offset = oTR.end.offset = 0;     findParams = GetFindParameters (2, null);     // finding any variable, no wrap    InitFA_errno ();                              // reset - it is write protected    oTR = oDoc.Find(oTR.beg, findParams);         // and do an initial find to get started.    while(FA_errno === Constants.FE_Success) {       jFound += 1;      oDoc.TextSelection = oTR;                   // set up the text range       aVarsRange = oDoc.GetTextForRange (oTR, Constants.FTI_VarBegin);  // this is an array      iVrLen = aVarsRange.length;                 // have not found anything other than 1 to be correct      if (iVrLen === 0) {                         // Hickup ?        InitFA_errno ();                          // track the progress        oTR = oDoc.Find(oTR.beg, findParams);     // prepare for next find        continue;                                 // while      }      oTextItem = aVarsRange[0];                  // have not found anything other than 1 to be correct      oVar = oTextItem.obj;      sVarName = oVar.VarFmt.Name;                // name of the variable      sValue   = oVar.VarFmt.Fmt;                 // contents of variable      oTR      = oVar.TextRange;                  // the text range of the variable      bIsSystem= (oVar.VarFmt.SystemVar !== Constants.FV_VAR_USER_VARIABLE);      aDocVars.push (new oVariable (sVarName, sValue, oVar, bIsSystem, oTR));      InitFA_errno ();                            // track the progress      oTR = oDoc.Find(oTR.beg, findParams);       // prepare for next find    }  }  goFMv.nDocVars = goFMv.aoDocVars.length;  RestoreLocation (oDoc, oSavedLoc);  SetDisplay (true);
} //--- end CollectVarsInDoc

 

From a more detailed trace I know that the statement on line 66 is in charge.

Viewing all 888 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>