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

How to insert Char Tab using Extendscript in Framemaker 12?

$
0
0

Hi,

 

I am currently trying to insert a Char tab into a new paragraph, I'd like to separate each variable I insert into the paragraph separated by a Char Tab.

 

I am updating an existing mif file. I am trying to figure how to insert the <Char Tab> using Extend Script.

 

Any help would be appreciated.

 

Thanks,

Sebin

======================================================

Existing Mif File Screenshot:

 

        <String `Attribute1: '>

        <Variable

         <VariableName `Variable_1'>

         <Unique 6767868>

        > # end of Variable

        <Char Tab>

        <String `Attribute2: '>

        <Variable

         <VariableName `Variable_2'>

         <Unique 6767812>

        > # end of Variable

        <Char Tab>


Counting line in paragraph

$
0
0

Hello,

 

I usually work with structured FM doc, but for once i need to work with unstructured doc.

 

I need to make a script that check if there is only few chararter at the last line of a paragraph, and if yes, to apply a "spread -2%". and check if i lost one line.

 

I was thinking, if i can compare the number of line of a paragraph before and after the "spread -2%" and if it's "after" is smaller than "before".

If yes => i lost one line in my paragraph.

 

In million paragaph, i can win few pages in my doc (doc large than 1.000 pages)

 

I already have script to walkthrouth all the paragraph of a doc, another to apply and/or check paragraph values (spread).

 

But how can i count the number of line in one paragraph?

Do i have to put my cursor in each line of my paragraph and check the FTI_LineEnd (normal, hard, hyphen) to know when i reach the end of my paragraph? Or there is another way?

ExtendScript doesn't recognize variables passed to doc.NewAnchoredFormattedVar (b_var, textLoc) !

$
0
0

Hi all,

 

I am currently developing a script that automates the addition of new paragraph text comprising variables and string. b_user_inputis the the variable name defined in framemaker which is input by the user. However doc.NewAnchoredFormattedVar is not able to recognize the same and prints nothing in the document. Then I tried putting the input string within quotes thinking it might work, but that didn't work too(i.e.  var  b_var = "\""+ffFmt.Name+"\"";

 

                                                 

          var bbFmt = doc.GetNamedObject (Constants.FO_VarFmt, b_user_input);   //b_user_input = "Variable_b"

          var  b_var =bbFmt.Name;

 

          doc.AddText (textLoc, "Var_b value: ");

          doc.NewAnchoredFormattedVar (b_var, textLoc);      //       doc.NewAnchoredFormattedVar ("Variable_b", textLoc);  This method works.

 

It would be great if you could let me know how to make this work.      

 

Thanks,

Sebin                          

How to get rid of "unsafe script"

$
0
0

Dear all,

I want to call a script from a menu and tool bar. In both cases I get the message

     Script Alert
     You are about to run a script in Adobe FrameMaker 2015. You should only run scripts from a trusted source.
     Do you want to run the script?

I can accept this with Yes and then the script is executed.

This is more than annoying. So I tried to use jsxbin. But this does not execute the script at all. In menus.cfg I have:

<Command ETBnudge <Label Nudge object info>  <Hypertext message openfile H:/Adobe/FrameMaker.13en/AdobeFrameMaker2015/fminit/configui/ETBnudge.jsx>> ««««««« warning about unsafe script  {Hypertext message openfile H:/Adobe/FrameMaker.13en/AdobeFrameMaker2015/fminit/configui/ETBnudge.jsxbin}} «««««« not executed  {Hypertext message openfile ETBnudge.jsxbin}} «««««« not taken from %appdata%, not executed
*** the following is executed in menu, but not in tool bar.  {Hypertext alerttitle Nudging objects: At zoom 100% unit is 1pt... SHIFT+ALT+arrow to nudge 6 units}}

How to get rid of the "unsafe" message ?

 

Thank You for any idea

What is the correct file association for jsxbin?

$
0
0

FoF (Friends of FrameMaker)!

Tying to execute a script from a menu (or a tool bar button) leads to the following problem
Things work correctly if calling a jsx script:

<Command ETBnudge  <Label Nudge object info>  <Hypertext message openfile C:/Users/Klaus/Documents/Adobe Scripts/ETBnudge.jsx>>

But using the binary form of the script, opens the script in NotePad (seems to be a default). Even after changing the file assocition for Open jsxbin to the same as it is for jsx (namely the ESTK) the binary script is opened as text in ESTK!

Of course opening a jsxbin file by any FM version just tries to open it as text.

 

=> So what is the correct file association for jsxbin ?

 

Klaus Daube

How to find if a file exists using FrameMaker with ExtendScript?

$
0
0

Dear Community,

 

How do I find out if a give file exist? I found an answer here: How to find if a file exists using FrameMaker API ?

Is there a similar function in ExtendScript?

 

I want to look up several files, but the code I use is rather slow.

 

var path = "D:\\Folder\\File.ext"
var doc = SimpleOpen(path, "");


if(doc.ObjectValid() == true){
    alert("The file exists");    }
else {    alert("The file does not exist");    }
doc.Close(Constants.FF_CLOSE_MODIFIED);

 

 

Regards

Fabian

Restructuring elements with Scripting

$
0
0

Hello All,

I have the following issue.  I am working with a milspec document.  We are working with tables in flight manual context.

Our correct element structure for a table is as follow:

<Figtable>

   <Tgroup>

         <Thead>

              <Row>  

                    <Entry> </Entry>

                                        </Row>

         <Tbody>

              < Row >

                   < Entry> </Entry></Row>

                                                       </Tbody>

                                                            </Tgroup>

                                                                      </Figtable>

 

The problem is when we run our conversion table on the legacy data, Frame is not putting the element "Tgroup" in the structure.  The following is what we get after running our conversion table:

  <Figtable>

          <Tbody>

               <Row>

                    <Entry> </Entry>

                     <Entry> </Entry>

                      <Entry> </Entry>

               </Row>

          </Tbody>

     </Figtable>

I wanted to write a script or macro that would correct the element structure for me.  Any suggestions?

Function equivalent to "Break Link" in the Edit-->Links dialog box

$
0
0

Hello fellows,

 

I wonder if there is an API (in framescript/extendscript) for breaking a link to an imported inset file (Excel sheet, Visio, etc).

 

Thanks,

Roman


FM initialisation sequence

$
0
0

I want to understand why the ordering of menu entries does not work for commands defined in ExtendScripts. It was reported in the old bug base as Bug#4110544 (this can no more be tracked). Hence I issued bug FRMAKER-2752. It turns out that even the following does not work (at the end of the menu):

«-- in StartUp folder ETBSaveAsOld.jsx defines these commands: ETBdocSaveOld, ETBbookSaveOld with label, shortcut and shortcut-label --»<Modify ETBbookSaveOld <Description Save book as old version [ETB] >><Order BookFileMenu.ETBbookSaveOld> <After BookFileMenu.SaveAs>><Modify ETBdocSaveOld <Description Save document as old version [ETB] ><Order FileMenu.ETBdocSaveOld> <After FileMenu.SaveAs>>

This can be because of the wrong assumption that the menu is interpreted after the script has been interpeted and new commands have been defined.

The script does not create errors and it installs a menu item at the end of the FileMenu and BookFileMenu. With the above appendix in the menu I want to move the menu entry to a more appropriate place.

 

For better understanding I tried to get the sequence of intialisation tasks from the Welcome screen of FM-13 (FM-14 seems to provide less information). Albeit this runs fast on my machine, I had captured it with SnagIt (some items are just 1 frame long!):

Kbmap
Localisation
Filters
Core
FMPopUpMenu
Font
Doc Preferences
Password
LoadConfigFile

But this does not reveal the sequence in which commands and menus are set up. In which sequence are the following tasks performed?

API clients (probably to be located before step 2 in the above list. FrameScript will define new commands

Read Startup folder (may define new commands) - IMHO also here a client (ESTK ?) is involved

Localisation: read workspace (menu and tool bar files)

What does  step 9 (LoadConfigFile) do? Does this read the customUI.cfg file and hence modify the menues read in step 2?

 

Is my assumption of processing sequence just wrong or is the process broken at another place?

Of course this can only be answered by Adobe or an expert with experience in deep sea diving...

Klaus Daube

Replace Element by Element

$
0
0

Hello,

 

When opening XML in FM, sometimes, FM can't apply correctly the EDD to my document.

Example on a book of 1.500 pages there can be around 20 superscript text that are display as normal normal text.

 

The only way i found is to forced FM to apply the EDD correctly by forcing him with Searching&replacing the <sup> element.

Or faster, replace the HighestLevelElement on each chapter (element call <CHAPTER>)

 

Would like to do it with a script (so i can add it to my open book script ... there are around 10 script at the opening of a book

I can select all the doc, get the HighestLevelElement name, can delete it or warp an element around it but can't replace the element by it self?

 

var vCurrentDoc= app.ActiveDoc;
var vFlow = vCurrentDoc.MainFlowInDoc;
var vPgf = vFlow.LastTextFrameInFlow;
var vFirstPgf = vFlow.FirstTextFrameInFlow;
var textRange = new TextRange();        textRange.beg.obj = vFirstPgf;        textRange.beg.offset = 0;        textRange.end.obj = vPgf;        textRange.end.offset = Constants.FTI_PgfEnd;        vCurrentDoc.TextSelection = textRange;
var vElement = vFlow.HighestLevelElement;
var vElemDef = vElement.ElementDef;

var vReplaceElem = vCurrentDoc.GetNamedElementDef(vElemDef.Name);
// vReplaceElem.Delete() or WarpElement();

 

So how to eaplce an existing element by itself?

Extract Index Markers

$
0
0

In Framemaker, can the product keyword that is stored in an index marker be extracted with an association to the models or parts# it references?

Script to Apply Conditional Tag based on Paragraph Tag?

$
0
0

I use conditional tags to apply automatic updates to headers and footers using variables. The conditional tag is applied to a paragraph based on what the paragraph tag is. The condition displayed is dependent upon where it is located in the hierarchy. For instance, let's say the RED conditional tag is higher than the BLUE conditional tag, which is higher than GREEN conditional tag. I apply the RED conditional tag to the paragraph that has the Red paragraph tag applied.

 

Could I use a script to search for the paragraph tags (e.g., Red, Blue, Green)  and apply the corresponding conditional tag? I would also want to ensure that no other conditional tags are applied to any of the text in each paragraph. Any and all help is appreciated. Thank you in advance!

 

Example:

RED

 

 

(Red) This paragraph uses the Red paragraph tag and has the RED condition applied.

(Blue) This paragraph uses the Blue paragraph tag and has the BLUE condition applied.

(Green) This paragraph uses the Green paragraph tag and has the GREEN condition applied.

 

RED

Same script simultaneously on two FM session/instances

$
0
0

Hi everybody,

 

I have an issue with a rather big script.

 

Here is what the script does:

  1. it runs over a *.ditamap and rearranges the many *.xml files into a few *.fm files for a new *.book
  2. a specifictitlepage.fm is added into the *.book
  3. TOC and index are generated and included as well
  4. formats and definitions are imported from a specificvariable.fm into to book.

The script works fine until there is more than one FM instance running it, i.e, until I use FrameMaker Publishing Server 2015, which runs a few FM instances simultaneously.

 

Here is what goes wrong:

  1. FM instance 'a' imports titlepage.fm from any other FM instance running
  2. the import is not applied on every *.fm file of the book.

Result: the books have the wrong titles pages, sometimes also the wrong footer and colors.

 

The script is ExtendScript and does not contain any app.ActiveDoc.

During the run, files are generated under \AppData\Local\Temp, could the mix occur due to a dissociation issue with those files?

Deleting condition formats but saving the contents

$
0
0

Hello all,

 

I hope someone from Adobe is monitoring this list, as there is lots of stuff that requires either more work on the ExtendScript coding or on the documentation.

 

I have almost finalized my conversion from unstructured FrameMaker documents with lots of conditional texts to structured FrameMaker, in which attributes take over the role of the conditions. I now want to delete the condition formats but keep the contents. This is possible via the menu: when I delete a condition format, I get a dialog that allows me to keep the content as unconditional text instead of throwing it out. Guess what ? The Delete() method for a CondFmt object does not take any arguments, and the default method is throwing out the content.

 

I can do a TextSelection on everything in the document and apply unconditional formatting to it, but that does not include the text in tables. And it is a hassle, as there should really be a way to tell the Delete() method for CondFmt what to do with the content. The options in the dialog should be available via ExtendScript somehow.

 

Thanks in advance for a quick reply. My deadline is approaching quickly !

 

Jang

Cannot initial API client in patched FM 2017

$
0
0

I have an FDK client that was developed in FM 12. While I did not test it extensively in the original release of FM 2017, it seemed to work. With the patch installed, it does not initialize (the "Cannot initialize API client ..." alert appears when I launch the patched FM 2017). Other older FDK clients initialize successfully with the patch.

 

What has changed that would affect some clients but not others? Does this one need to be recompiled?


FrameScript dialog box not appearing

$
0
0

When I select a script from the FrameScript menu, a dialog box should appear where I can select a language to change the text inset flows in my document. This used to work on my machine, and it works on my colleague's machine, but the dialog box no longer pops up for me. But the box must be somewhere because if I press Enter, the script runs as if I selected the first option on the list.

 

I was on FM 10 when the problem first occurred. I've since installed FM 2017, but there's no change. The box still doesn't pop up.

 

Help? Thanks in advance. This has stumped both myself and our IT department.

FM-14: multi-code commands not working any more

$
0
0

I have just filed 2 bug reports

FRMAKER-2807 Script can not set multiple document view properties

FRMAKER-2808 Multi-code commands not working anymore

All is fine until FM-13, but in FM-14 commands comprising muliple codes do not work correctly: only the first of multiple codes is executed.

The bug report contains the procedure to verify the problem.

 

Since years (aka FM 4) we have these menu meodifictions, first from Shlomo Perets, later from me which add, for exaple the commands PrintingView and EditingView. They define a set of view properties:

EditingDisplay: Show Borders and Text Symbols (others are untouched)

PrintingDisplay: Hide Borders, Rulers and Text Symbols; Show Graphics  (others are untouched)

These two commands were used in tool bars.

 

I first encountered the problem 2808 and wanted to use a script to bypass it...

 

Klaus Daube

Set all flows in a document to just one flow

$
0
0

Hi,

 

I'm converting legacy docs to DITA. The conversion process is failing when there are multiple flows in a document. Even though I tried to set all the flows to the same flow using the menus in Framemaker, during the conversion process some rogues flows turn up. Many of the flows are often quite tricky to find.

 

Is there a script to set any all flows in a document to the same flow?

 

Thanks

 

Ronan

Can't script

$
0
0

In FrameMaker  (Help -> About Framemaker says I'm running 13.0.1), when I click File -> Script -> New Script, nothing happens.  When I click File -> Script -> Run and select a simple script I created from the tutorial, nothing happens.  What could be wrong?  Is my install of FM not authorized to run scripts - how would I verify that's the case so I can go to my company and tell them what I need them to order?  Thanks!

FM-14: Setting View options incorrect

$
0
0

Dear all,

Having discovered that in FM-14 the multi-code commands do not work correctly, I thought to bypass this flaw by a script. However, also this is not working correctly. With the change that the view properties are no more document settings, but session settings, things might have been mixed up. oDoc.ViewOption (e.g. oDoc.ViewBorders) seem to be read-only now (until FM-13 they were read/write). Hence I need to check and then toggle:

 

// test ETBSubstituteLostCommands.jsx
#target framemaker

// With View > Options set Grid lines, Borders, Text Symbols, Rulers and Graphics to ON
var   oDoc = app.ActiveDoc;
Console ("Initial setup:\t"   + oDoc.ViewBorders + " " + oDoc.ViewTextSymbols + " "                              + oDoc.ViewRulers  + " " + oDoc.ViewGrid + " "  + oDoc.ViewNoGraphics);

SetAllOff ();
Console ("SetAllOff:\t\t" + oDoc.ViewBorders + " " + oDoc.ViewTextSymbols + " "
                              + oDoc.ViewRulers  + " " + oDoc.ViewGrid + " "  + oDoc.ViewNoGraphics);
// result Initial setup:    1 1 1 1 0
//        SetAllOff:        1 1 0 0 1  Borders and text symbols not cleared!

function SetAllOff () {
var oDoc,
    cmd1 = app.GetNamedCommand ("ViewBorders"),       // these are all toggles    cmd2 = app.GetNamedCommand ("ViewTextSymbols"),    cmd3 = app.GetNamedCommand ("ViewRulers"),    cmd4 = app.GetNamedCommand ("ViewGridLines"),    cmd5 = app.GetNamedCommand ("ToggleGraphicsDisplay");  if (!app.ActiveDoc.ObjectValid()) {    alert (localize (gsMsgNoDoc));    return;  }  oDoc = app.ActiveDoc;  if (Doc.ViewBorders == 1) {    Fcodes ([cmd1.Fcode]);                        // => set Borders      OFF  }     if (Doc.ViewTextSymbols == 1) {    Fcodes ([cmd2.Fcode]);                        // => set Textsymbols  OFF  }  if (oDoc.ViewRulers == 1) {    Fcodes ([cmd3.Fcode]);                        // => set Rulers       OFF  }  if (oDoc.ViewGrid == 1) {    Fcodes ([cmd4.Fcode]);                        // => set Gridlines    OFF  }  if (oDoc.ViewNoGraphics == 0) {    Fcodes ([cmd5.Fcode]);                        // => set Graphics     OFF  }  return;
} // --- end SetAllOff

 

I have reported this as bug FRMAKER-2807

 

If this is not a bug, but a programming error of mine - please give me a hint!

Viewing all 888 articles
Browse latest View live


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