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

Find overflow Text

$
0
0

Hi every one

 

is there a script that help to find the text boxes with overflow text (like in indesign with overset text)


How to trigger a refresh of a dropdown list when the selection is changed

$
0
0

Hi,

 

This is a general ExtendScript question, but since I'm working with FM, I'll ask here first. I have a bit of a paradox here and I'm not sure of the best way to handle it.

 

I have a dialog box with a dropdown list, where I want to refresh certain controls when the user changes the selection in the list (dropdownList.onChange). This includes refreshing the contents of the list itself. However, the problem is, as soon as I try to refresh the list contents, it triggers onChange again. So, if I put the call to refresh the box within the onChange handler, it results in an endless loop, because my refresher function triggers onChange when it refreshes the list.

 

Does anyone know a better methodology, where I can safely trigger a refresh of a dropdown list within the list's own onChange event handler? I really wish that onChange was reserved for a user action only, or there was at least some property to that effect.

 

Russ

Read graphic Object properties 'scaling'

$
0
0

Hi all,

 

I am trying to read 'scaling' graphic Object properties values using in below code.  In case graphic having 60% that time also I am getting only 100%.So can I get some help? Thank you very much.

 

function CheckScaing(doc)
{   graphicObj = doc.FirstGraphicInDoc;
 while(graphicObj.ObjectValid())     {        graphicObj = graphicObj.NextGraphicInDoc;              if(graphicObj.type == Constants.FO_Inset)                {                  name = graphicObj.InsetFile;                  var insetDpis=graphicObj.InsetDpi                  alert(insetDpis)                  }        }
}

Numbered list count

$
0
0

Hi All,

 

How to get a Numbered list paragraphs count in frame maker - 11 application document.

 

Thanks for any help.

applying fcode to a text range?

$
0
0

Hi all,

 

I'm trying to apply an fcode to a text range.

 

If I manually select text, this code makes the text bold:

fcodes = new Array();

fcodes[0] = FCodes.TXT_BOLD;

Fcodes(fcodes);

 

However, if I try to programmatically select the text, the fcode has no effect:

var tr = new TextRange (); 

tr.beg.obj = tr.end.obj = pgf; 

tr.beg.offset = 0; 

tr.end.offset = 5;

fcodes = new Array();

fcodes[0] = FCodes.TXT_BOLD;

Fcodes(fcodes);

 

I fear I'm missing something simple or obvious. Must my code explicitly toggle the text range as "selected"?

 

-Alan

Where is the "trusted source" for FrameMaker 12?

$
0
0

When I run a script from a command line, I get the "You are about to run a script in Adobe FrameMaker 12. You should only run a script from a trusted source." Etc. The ExtendScript Toolkit docs say "the user-script folder of installed Adobe applications". Any idea where this would be for FrameMaker 12? Thanks.

 

-Rick

Calling an ExtendScript script from the command line

$
0
0

Hi! I can call an ExtendScript script from a command line just by using its path, but is there a way to pass parameters to the script? Thanks. -Rick

Setting AFrame height to the height of a graphic inside aframe plus padding

$
0
0

Hello fellows,

I am trying to set a permanent bottom padding between an anchored frame and a graphic object (embedded Visio) that is inside the anchored frame.

However, instead of getting that padding below the graphic, the aframe becomes really small, and only 20% of the graphic is exposed.

 

The code goes like this:

...

SET vFrame = vCurrentDoc.FirstGraphicInDoc;

Loop While(vFrame)

 

IF vFrame.ObjectName = 'AFrame'

SET vFrame.AnchorType = AnchorBelow;

SET vFrame.GraphicIsSelected = 1;

 

SET vGraphic = vFrame.FirstGraphicInFrame // Select the 1st graphic in the frame

 

SET vFrame.Width = vFrame.TextLoc.InTextObj.Width;

SET vFrame.Height= vGraphic.Height + 5mm; //Here is the padding of 5mm

Set vGraphic.LocY = 0mm;

Set vGraphic.LocX = (vFrame.Width - vGraphic.Width) / 2;

ENDIF

...

 

Please, advise!

Thank you!


How to Remove the Table Title of a table from its frame

$
0
0

Hi,

I am working on conversion of Frame documents to XML. While working on the conversion table, I see that tables with a table title in a frame like the one below get incorrectly converted to XML. I want to delete the frame and move the table title out of the frame. How do I make this change universally?

 

table_designer.JPG

Thanks,

 

Nishita

How to execute a FrameMaker command (ExtendScript)

$
0
0

Hi, does anyone know how to execute a command that your script did not create? In particular, I want to invoke the Edit > Update References command and launch that dialog box.

 

Thanks,

Russ

[Ann] HTML and CHM version of FrameMaker 12 Javascript Reference

$
0
0

Just dropping by (I'm not an FM user) to announce that I have made a conveniently browseable version of the Javascript Reference for FM 12, in the formats HTML (lots of files) and CHM (single file in Windows Help format; non-Windows users will need a CHM viewer such as iCHM for Mac). Thanks go to Rick Quatro (http://frameautomation.com) for his support.

 

Downloads are available at Indesign JavaScript Help -- scroll down to "New: FrameMaker 12", and the HTML files can also be browsed online at Adobe FrameMaker-12 Object Model JS: Table of Contents (with additional thanks to John Hawkinson for the generous donation of bandwidth).

How to assign an F (function) key as a command shortcut

$
0
0

Hi, I'm looking to assign a function key (like F10) as part of a command shortcut (ExtendScript). Does anyone know how to do this? Thanks.

 

Russ

Setting property ssval

$
0
0

Hello fellow scripters,

 

I am trying to get a script include a TOC in a generated book. I can add the new BookComponent (copied from a template file) as a TOC, set it to generatable and include it in the update process, but all I get is an empty TOC, as the ExtractTags property of the new BookComponent is not set. I tried to set this property by passing it a string array but that action is completely ignored. Then I got the propVals array and tried to set the property there, then pass back the propVals. That is where FM12 hangs up and I have to restart it to become responsive again.

 

This is the piece of code I am using:

 

oaProps = oComp.GetProps ( );
i = GetPropIndex ( oaProps, Constants.FP_ExtractTags );
oaProps[i].propVal.ssval.push ( "Title_0" );
oaProps[i].propVal.ssval.push ( "Title_1" );
oaProps[i].propVal.ssval.push ( "Title_2" );
oComp.SetProps ( oaProps );

 

Maybe I am doing something illegal here but the local copy of my properties does show the strings as I push them into the ssval array. There must be a specific way to set these strings array propVals but there is no documentation about it. Does anyone have experience with this ?

 

Thanks

 

Jang

Use of ElementDef.WrapElement() to create a specific parent element

$
0
0

I have a "lettuce" element that is not wrapped by a "bread" element.  The task is given the selected "lettuce" element to wrap it in a "bread" element.

 

Documentation has that the ElementDef.WrapElement() returns void.  When I wrap the "lettuce" element, the resulting parent element is also "lettuce".  The "lettuce" element is now wrapped by a "lettuce" element.

 

Thoughts on how to impose a "bread" element that wraps around the "lettuce" element?

 

var doc = app.ActiveDoc;

var elementRange = doc.ElementSelection;

var elementLoc = elementRange.beg;

var parentElement = elementLoc.parent;  // not "bread" element

var childElement = elementLoc.child;  // "lettuce" element

PreChecksAndProceed(parentElement, childElement);

 

function PreChecksAndProceed(parentElement, childElement) {
    var elemDef, name;
   
    if (!childElement.ObjectValid())
    {
        alert ("AciveDoc has no ElementSelection");
        return;
    }

    elemDef = childElement.ElementDef;
    if (!elemDef.ObjectValid())
    {
        alert ("Selected element's (elemDef.ObjectValid() == false)");
        return;
    }
   
    name = elemDef.Name;
    if (name != "Lettuce")
    {
        alert ("Selected element is not Lettuce.");
        return;
    }

    if (!parentElement.ObjectValid())
    {
        alert ("Selected element's (parentElement.ObjectValid() == false)");
        return;
    }

    elemDef = parentElement.ElementDef;
    if (!elemDef.ObjectValid())
    {
        alert ("Parent element's (elemDef.ObjectValid() == false)");
        return;
    }
   
    name = elemDef.Name;
    if (name == "Bread")
    {
        alert ("Selected Lettuce element is already wrapped by a Bread element.");
        return;
    }

 

    Wrap_Element(childElement);
    return;
};

function Wrap_Element(elementToWrap) {
    var elemDef = childElement.ElementDef;
    if (!elemDef.ObjectValid())
    {
        alert ("Selected element's (elemDef.ObjectValid() == false)");
        return;
    }
   
    elemDef.WrapElement();


    // todo the selected element is "Lettuce" that wraps the initial "Lettuce" element.
    return;
};

How to change character tag

$
0
0

Hi, does anyone know how to change the character tag, I want to change it from body to link for some marks, thanks in advance.


How to access the Publisher module

$
0
0

Does anybody know if the Publisher module is exposed to FM's Extendscript (or FDK)? I looked through all of the scripting info and the FDK info, .h and config files and couldn't find any references to it other than the TPUBforFMDoc (Book/DITA  esc ph shortcut) command. I need to kick off the Publish module after some manipulation and use a specified STS file depending upon the manipulation.

Building DLL for FDK API

$
0
0

In the FDK Programmer's Guide, it says

 

<quote> 

 

 

Compiling and registering your own FDK clients

....

 

With Code Generation still selected, choose Single-Threaded from the Runtime Library

popup list.

</quote>

 

However, in Visual Studio, there are only 4 options for Multi-threaded and no option for Single-threaded.  I'm running Visual Studio Express 2010, v10.0.30319.1.  The instructions are quite detailed, so I think I am looking in the correct place.

 

Any suggestions?

 

How to create a new FM-Doc

$
0
0

Dear all

I see how to create a new book-component,

var comp = book.NewSeriesBookComponent(0);
comp.Name = "C:\\SomeDocumentPath";

but all I want is creating a new independent FM-document, write something to it, (which i have collected from the docs of a book or a singualer doc).

Any ideas?

Thank You

How to cope with "undefined is not an object" ?

$
0
0

I'm tiptoeing towards a solution, but stepped on a thumbtack:

The following snippet creates an error in the function GetTplParams

var template = "DDD-BibFM-tpl.fm";  // located in script-dir var outFile  = "DDD-BibFM.fm";      // located in the source dir   oDoc = OpenTemplate (); alert ("Is template open now?"); function OpenTemplate () {   var tplDir, tplFile, openParams, openReturnParams, oFile;   tplFile = "E:\\_DDDprojects\\FM+EN-escript\\escript\\DDD-BibFM-tpl.fm" // SimpleOpen does not take the tplFile, but opens the dir of the active document //  oFile = SimpleOpen (tplFile, true);   openParams = GetTplParams ();    openReturnParams =  new PropVals();    oFile = Open (tplFile, openParams, openReturnParams);    return oFile; }   function GetTplParams() {  // =>>> "undefined is not an object" on line 22 var params, i;  // Change the params   i = GetPropIndex(params, Constants.FS_RefFileNotFound);    params[i].propVal.ival = Constants.FV_AllowAllRefFilesUnFindable;    i = GetPropIndex(params, Constants.FS_FileIsOldVersion);    params[i].propVal.ival = Constants.FV_DoOK;    i = GetPropIndex(params, Constants.FS_FontNotFoundInDoc);    params[i].propVal.ival = Constants.FV_DoOK;    i = GetPropIndex(params, Constants.FS_LockCantBeReset);    params[i].propVal.ival = Constants.FV_DoOK;    i = GetPropIndex(params, Constants.FS_FileIsInUse);    params[i].propVal.ival = Constants.FV_OpenViewOnly;    i = GetPropIndex(params,Constants.FS_AlertUserAboutFailure);    params[i].propVal.ival=Constants.FV_DoCancel;  /*   i = GetPropIndex(params,Constants.FS_MakeVisible );    params[i].propVal.ival=false;  */   return (params);  }

(inserting JS code really has its quirks in this editor).

Saving (and reading) RTF

$
0
0

Dear all patient helpers,

My current project is 're-furbishing' the FameMaker to EndNote' connection. This task comprises several steps:

  1. Collect temporary citations (such as [Daube, 1969, #123] ) from text, footnotes and tables into an array. This part already works fine (I had to postpone further development for a year now...).
  2. Then I write this data to a new document (which is created from the template) - with your help this came to work today.
  3. This file then is saved as rtf to be worked off by the bibliographic application EndNote (or Citavi in another case) to resolve the temporary citations into formatted citations and the bibliography.
  4. After that the modified rtf is opened as an FM docment. The information from this is used to replace the  temp. citations in the user-document/book by the formatted citations.
  5. The user then copies the bibliography (as text only) into his appropriate chapter/section and formats it to his liking.

For step 3 I have now researched a lot and found this:

  • app.ExportFilters does not provide the list of filters as stated in the FM Scripting Guide.
  • For FrameScript Johannes Graubner wrote:
    SAVE Document DocObject (docVar) File(ofilename) FileType(SaveFmtFilter) FilterFormatID('RTF');
  • Talking about filetype hint strings the FDK Programmers Guide (FDK-PG) informs that format ID would be ‘RTF ‘. But how to use this in eScrpt?
  • The Filetype hint string syntax in FDK-PG gives some information, but what vendor code shall be used for RTF?
docId = F_ApiGetId(0, FV_SessionId, FP_ActiveDoc);
params = F_ApiGetSaveDefaultParams();
i = F_ApiGetPropIndex(&params, FS_FileType);
params.val[i].propVal.u.ival = FV_SaveFmtFilter;
i = F_ApiGetPropIndex(&params, FS_SaveFileTypeHint);
params.val[i].propVal.u.sval = F_StrCopyString((StringT)"0001ADBEHTML");
  • At another place () Hint strings for the standard installation of filters) FDK-PG states: Microsoft RTF => 0001AW4W0191
  • Another information can be found on RTF 1.6 filter hint revealed! : '0001ADBIRTF '

So my interpretation of all this leads to this snippet:

var file = app.ActiveDoc;
SaveFileRTF (file);

function SaveFileRTF (file) {     var params = GetSaveDefaultParams();  var returnParamsp = new PropVals();  var i;   i = GetPropIndex (params, Constants.FS_FileType);  params[i].propVal.ival = Constants.FV_SaveFmtFilter;   i = GetPropIndex (params, FS_SaveFileTypeHint);  params[i].propVal.ival = "0001ADBERTF ");   file.Save(file.Name, params, returnParamsp);  return;
}

But alas, this reports a stange error: "Semicolon expected on line 13". Even If you help me to overcome this the next swamp lurks in step 4: how to open  the RTF?

Viewing all 888 articles
Browse latest View live


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