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

How to write stuff to the console

$
0
0

Hello all,

 

I know I have seen the method for writing some message to the FM console somewhere, but searching the Scripting Guide for the word 'console' does not take me to that info. Can anyone tell me which command to use or where it is described ?

 

Thanks in advance for answering a probably stupid question (10 easy points to gain I guess)

 

Jang


How do you rename a component file (in a book) from the FDK?

Edit Script opens Notepad, not ESTK ?

$
0
0

In the documentation for FM10 and FM11 it says that clicking the Edit button in the Script Library panel opens the script in the ESTK editor. Not on my machine: it opens in NotePad instead. Is there a configuration setting I need to define to make the documented behavior work ?

 

Thanks

 

Jang

Strange behavior of breakpoints

$
0
0

Hello fellow scripters,

 

I have a problem with the behavior of breakpoints in the ESTK. If I set breakpoints inside an if / else construct and start the script, the ESTK automatically changes those breakpoints to an inactive state. If this is a feature, I would REALLY like to understand the rationale for this, as I completely fail to see how any automatic overrule by the ESTK could help me debug my scripts.

 

Is this something I can tell the ESTK to NOT do this ? I don't see why I would not be able to set breakpoints inside code that may or may not be visited.

 

Any insight in this would be appreciated. If no satisfying rationale can be given I will register it as a bug with Adobe.

 

Ciao

 

Jang

How to get selected images?

$
0
0

Hi all,

can anyone help with getting a list of selected images?

E.g., to get selected tables I use

doc.GetTextForRange(doc.TextSelection, Constants.FTI_TblAnchor)

 

Thanks in advance!

Calling one script from another

$
0
0

InDesign has a nice mechanism for calling one script from another, so code can be made modular. What about FrameMaker ExtendScript? What methods are people using to call one script from another? Thanks for any suggestions.

 

Rick Quatro

Import method does not work

$
0
0

Hi there,

 

Does anyone have experience in using the Doc.Import method to pull another FM file in via a script? I have tried all settings but Frame does not recognize the file type, even though it is a perfectly normal FM binary file. I can import the file manually, no problem. But when calling the Import method from an ExtendScript, Frame keeps showing the "Unknown File Type" dialog.

 

Any help is greatly appreciated. I am running up against a wall with these freaking PropVals arrays. How come the stuff that works perfectly going through the UI does not work as it should when trying to automate things ?

 

Jang

Need some support with syntax from FDK to ExtendScript : Getting FontFamily

$
0
0

Hi there, I am using some scripts to traverse my text and add tags to specific characters when they use a given font. This works fine if the PlatformName is known, but every now and a while these seem to be not set. I therefore want to do the following : If no FontPlatformName get the FontFamily instead, but I'm struggling to get it working as the scripting references are a bit limited on covering conversion.

 

This is what's in the fdk (simplified for my needs) :

 

families = F_ApiGetStrings(0, FV_SessionId, FP_FontFamilyNames);

 

for (i=0; i < families.len; i++)

if(F_StrIEqual(families.val[i], "myFont")

     /* Do something*/

) break;

 

But I can't get it working on extendscript

 

What I have now is something like below :

 

var doc = app.ActiveDoc;

var families = Constants.FP_FontFamilyNames.GetStrings;

 

for (var i = 0; i < families.length; i += 1)

{

// alert fontname of families.val[i]

}

 

 

But I'm doing something wrong as it fails on my for loop. Anybody that can help getting the syntax correct ?

 

Thanks in advance already


How to know if an object is a File or a Folder ?

$
0
0

Hello again,

 

I am looking for an easy method to determine whether a File or Folder object point to an actual file or to a folder. Both objects seem to have the same set of properties, except the File element has more. But the Data Browser in the ESTK refuses to show the contents of a File object when I have not actively retrieved the properties yet. Is this simply a matter of testing whether a file-related property exists in the object? Is there another, more elegant method, an undocumented feature, for instance a property IsFolder or something similar ?

 

Ciao

 

Jang

Changing one font into another using extendscript

$
0
0

Hi there, I've been trying to replace one font by another, but no success , and it seems hard to find some good examples on how to do this, though it looks to me like something rather common to do with extend script. Could someone lead me in the right direction ? If for instance I would like to replace a font called 'font1' with weight 'bold' with another one called 'font2' with weight 'bold' into a document, how should I do this ?

How do I convert Word to Frame 7.2, and replace the styles with other tags?

$
0
0

How do I convert Word to Frame 7.2, and replace the styles with other tags? E.g. Normal > Body1, Heading 1 > H1,  etc.

Keyboard shortcuts in custom commands

$
0
0

Hi. I am trying to specify Control+, as a keyboard shortcut in a custom FrameMaker command defined in an ExtendScript script. I am using this:

 

var cmd1 = DefineCommand(1, "LinkToHeadingStepOne", "L1", "^,");

 

The command works, but the keyboard shortcut doesn't. Any help would be appreciated. Thanks.

 

Rick

Adding a folder to a book

$
0
0

Hi,

 

I am trying to add a folder to an empty book, which I have as the ActiveBook. This does not work:

 

#target framemaker

var book = app.ActiveBook;
var folder = book.NewBookComponentOfTypeInHierarchy ("Widget Guide", Constants.FV_BK_FOLDER);

 

Anyone else been able to add a folder to a book? There is an FDK 11 sample showing how to do it with the FDK, but I can't find any ExtendScript examples.

 

If there are any Adobe engineers reading this, please help! I am trying to help a paying customer (Microsoft) that wants to switch to FrameMaker. Thanks.

 

Rick

Table to text

$
0
0

I need to convert all Note, Caution, and Warning tables to text. These tables only have one row.

 

So my concept is:

  • Search through the active FrameMaker document for a table
    • If the table has only one row, copy the text in the second cell
    • Create a new paragraph after the table
    • Paste the text
    • Delete the table
  • Move to the next table

 

But my limited coding is failing to turn my concept into a working script. What all have I done wrong?

 

#target framemaker

 

var doc=app.ActiveDoc;

 

var tbl=doc.FirstTableInDoc; //Get the first table.

countTableRows (table);

 

while (countTableRows(table) === 1 ) { //Test to see if the table has only one row.

    //Get the right-hand cell

    var row=tbl.FirstRowInTbl;

    var cell=row.NextCellInRow;

    var newText= new TextRange();

    doc.TextSelection=cell;

    doc.Copy(0); //Copy the text

 

    var newPgf=doc.NewSeriesObject(Constants.FO_Pgf, tbl); //Create new paragraph after table

    newText.beg.obj = newPgf;

    newText.beg.offset = 0;

    newText.end = newText.beg;

    doc.TextSelection = newText;

    doc.Paste(0); //Paste the text

 

    doc.DeleteTable (tbl); //Delete the table

}

 

    var tbl=doc.NextTableInDoc; //Move to next table.

 

function countTableRows(table) {

    var count=0, row;

    row=table.FirstRowInTbl;

    while (row.ObjectValid()) {

        count=count + 1;

        row=row.NextRowInTbl;

    }

    return count;

}

 

// Refresh document (Ctrl+L)

doc.Redisplay();

Boolean Condition Expressions

$
0
0

Unlike Condition Formats, Paragraphs, etc., Boolean Condition Expressions are apparently not stored in a linked list. In ExtendScript, you can get a list of the Expression names with this:

 

var doc = app.ActiveDoc;
var exprCat = doc.GetBuildExprCatalog();

 

This gives you an array of strings containing the Expression names. I am not sure what the FrameScript or FDK equivalents are, but I assume there is a way to do this.

 

Once you have the list, you can get each definition by doing this:

 

for (var i = 0; i < exprCat.length; i += 1) {    var expr = doc.GetBuildExpr (exprCat[i]);    Console ("Name: " + exprCat[i] + " Definition: " + expr); 
}

 

I hope this will helpful to someone in the future. Please let me know if you have any questions or comments. Thank you very much.

 

Rick


Micropositioning i character-definitions

$
0
0

I'm working on a quite large project in structured FM, where I got a lot of fractions.

The content is imported in an xml-file (where I have defined elements for the numerator and the denominator), and formatted in FM10 using templates. I need to be able to define two character-definitions for the numerator and denominator of the fraction, and to finetune them with micropositioning.

Is it possible to do this, without having to use Alt+left/right/up/down arrows manually?

 

DagB

Formatting elements with pgfFmt

$
0
0

Hi all,

 

I'm a complete beginner at FrameMaker and scripting of the same, and I've been tasked with converting S1000D documents in XML format into FrameMaker files using an unstructured template.

 

I've managed to import some XML files into FrameMaker and saved them as .fm files. Now I need to set different paragraph formats on different elements in those files. The paragraph formats are taken from an unstructured document and imported into the files. How can I assign them to the different elements?

 

I'm currently walking through the elements in the document from mainFlow.HighestLevelElement using the FirstChildElement and NextSiblingElement methods and checking the ElementDef.Name for the tag name, which works, but I've so far been unable  to find a way to set a format on the Element. Is it possible? Is there a better way? Any suggestions welcome.

 

Best,

Lisbeth

Is it possible to conver Frame maker file into PS using FDK

$
0
0

Hi All ,

Just wanted to know quickly is there any popsibility to convert Framemaker files into PS (Post Script) using FDK script.

We have done successfully conversion of Framemaker to PDF using FDK script.

Similarly wanted to do conversion of Framemaker file to PS.

please let us know options /any link related to the same.

Software :: Framemaker 11

 

Best Regards

Ramesh babu katta

Setting a condition tag on an element

$
0
0

Hi all,

 

I've got a bunch of XML files that I import to FrameMaker using a custom structured application based on S1000D. I would like to not show some of the data in the XML files in the final FM document, but preferably not remove it. Is there some way to set condition tags on an element using extendscript? Or is there a way to specify it in the EDD for the structured application? Any other suggestions?

 

Best regards,

Lisbeth

How to transmit the data?

$
0
0

In this script I create a window with an Edittext field and two buttons. The user can write something in Edittext field. How to read these data? I want to use it like a pattern in regular expressions.

I made an Edittext field a variable. How to transmit the data from it?

 

function SnpCreateDialog()
{
this.windowRef = null;
}


SnpCreateDialog.prototype.run = function()
{
// Create a window of type palette.
var win = new Window("palette", "Поиск",[100,100,400,250]);  // bounds = [left, top, right, bottom]
this.windowRef = win;

// Add a frame for the contents.
win.pnl = win.add("panel", [25,15,275,135], "Введите данные для поиска");

// Add the components, two buttons
    var txt = win.pnl.add("edittext", [15,25,230,45],"");
    //win.pnl.txt = win.pnl.add("edittext", [15,25,230,45],"");
win.pnl.okBtn = win.pnl.add("button", [15,75,105,95], "OK");
win.pnl.cancelBtn = win.pnl.add("button", [140, 75, 230, 95], "Cancel");

// Register event listeners that define the button behavior

 

var re = new RegExp(pattern);
   
    win.pnl.okBtn.onClick = function() {
  $.writeln("OK pressed");
  alert(re);
        //win.close();
};
win.pnl.cancelBtn.onClick = function() {
  $.writeln("Cancel pressed");
  win.close();
};

// Display the window
win.show();
 
return true;
   
//var re = new RegExp (txt);
//alert(re);
}

 

if(typeof(SnpCreateDialog_unitTest) == "undefined") {
    new SnpCreateDialog().run();
}

Viewing all 888 articles
Browse latest View live
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>