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

Correct way to search for character within a string

$
0
0

I am trying to search for the occurrence of a "(" within a text string - unfortunately my code is reported as incorrect.

 

I extract the text correctly but cannot create the search statement correctly:

 

var mylistpgftext = pgf.GetText (Constants.FTI_String)   

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

{                                                        

    var mylistitem = mylistpgftext[i].sdata              

    var mybracketpos = mylistitem.search(/(/i)    --------------error line-----------------       

    if (mybracketpos != -1)                              

    {                                                    

      alert(mylistitem)                                  

    }                                                    

}                                                       


Looking for Scripts that Replaces Text and Master Pages (Batch Missing Files and PDFs)

$
0
0

I have just found the Script Library panel in FM 10. (Always used InDesign before.)

 

I'm up to replace a text string and two master pages in 100+ documents. Tried to google for some nice solutions to make this automatically but cannot find any scripts/macros to FM at all.

 

Do you have som tip where to find such scripts/macros?

 

To facilitate my work I also look for a batch script that automatically updates the image pathes in each framemaker file (image folder has been renamed).

And at a last FrameMaker -> PDF Batch converter.

Range comparison

$
0
0

Hi all,

 

I'm new in FDK and try to compare two ranges to define which of them is the first one in the document. But I didn't find any function in FDK.

Does anyone know ways to do it?

Help F_ApiEnableUnicode(True) returns -1

$
0
0

With FM 12 and fdk 12 the F_ApiEnableUnicode(True)  returns -1. Help me pls.

The function is not working, with FM 10 I haven't this kind of problem. I tested the following code as described in fdkprogrammerguide.pdf and the result is incorrect, it displayed  the same characters both with Unicode disabled / enabled

F_ApiEnableUnicode(False);

F_ApiAlert("This is Unicode: \xC3\xA4 \xEB\xAE\xA4 \xD8\xB4",FF_ALERT_CONTINUE_NOTE);

F_ApiEnableUnicode(True);

F_ApiAlert("This is Unicode: \xC3\xA4 \xEB\xAE\xA4 \xD8\xB4",FF_ALERT_CONTINUE_NOTE);

Help F_ApiEnableUnicode(True) returns -1.

$
0
0

With FM 12 and fdk 12 the F_ApiEnableUnicode(True)  returns -1. Help me pls.

Start a new book and add files

$
0
0

Hi, I'm fairly new to FrameMaker scripting. This is what I'm trying to do and where I'm at:

 

1) Convert .mif files to .fm files (completed)

2) Start a new book

3) Add each .fm in folder to book in step 2.

 

Any help in getting started with step 2 & 3 would be greatly appreciated.

 

Thanks, Kevin

Applying a Character Format to a Character

$
0
0

I am trying to apply a character format to a single character.

 

I have tried :

 

MyDoc.SetTextVal(myrange,Constants.FO_CharFmt ,"RoundFont")

 

and

 

var charFmtId = MyDoc.GetNamedObject(Constants.FO_CharFmt, "RoundFont");

var myprops = MyDoc.GetProps(charFmtId)

MyDoc.SetTextProps(myrange, myprops); 

 

neither work unfortunately - I have been trying for two weeks!

 

I know the "myrange" is Ok because I can delete characters in the range correctly and add a character instead.

Script does not work anymore after updating to FM 12.0.3

$
0
0

Hi,

 

With TCS5, Robohelp would crash when importing FrameMaker books to RH, because the FM files had embedded graphics. So, I found a script to externalize the graphics before doing the import (the script is: ExtendScript of the week: Externalizing Graphics « TechComm Central by Adobe). However, this script is not working since I updated from 12.0.2 to 12.0.3. And without this script, we can't create HTML5 output!

 

Although I wrote a few simple scripts, this one is quite complex and would be difficult to debug. Anyone here knows what could have changed to make the script useless after such a small update? Or can update this script to make it work?

 

Thanks!


Add text in "Track edit changes" mode

$
0
0

Hi all,

 

I have a question related to text changing from API (FM 10 and 11). If "Track edit changes" is enabled and I try to add a text using F_ApiAddText function then these changes are not appeared as "Changes" in the editor view (color of the text isn't changed).

Is it possiple to add text using API and apply the "changes" style?

ES for FM10: Adding text at insertion point

$
0
0

Hello fellows,

 

What's the code for current insertion point (where the cursor is currently placed?)

I saw code for adding text in the beginning/end of pgf but not at the current insertion point.

 

Thank you in advance!

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

Why is my startup script getting a timeout error in FrameMaker?

$
0
0

Using FM 11

ExtendScript

Windows 7

 

I'm running an ExtendScript from the FM Startup directory, by starting FM from a batch file. The Extendscript opens multiple book files (one at a time) and does a save as pdf for each one. FrameMaker terminates the script with a timeout error at random points in the script after only one or two saves. The Extendscript runs fine when I run it from the FM Scripting window. It only times out when I run it as a startup script. Is there some workaround for this? Sadly, I find no documentation about this.

Creating a variable that contains the value of the Modification Date (Long) system variable

$
0
0

Can someone tell me how to write a script for creating a variable, named DocDate, that contains the value of the Modification Date (Long) system variable? Or to write a script that creates a variable,named DocDate, that contains the current date??? I can't seem to find a whole lot of documentation on ExtendScript script writing.

Fit Frame to content

$
0
0

I'm using Frame maker 10, and need text frame need to fit into content. What I'm doing is drag the frame manually. Is there any shortcut or script for this?@

Disabling notification that was enabled in code from an old Extendscript script

$
0
0

Not knowing much about notification, but believing that I wouldn't do anything that couldn't be undone, I experimented with using notification in an old script (which I'll call oldScript.jsx for reference) in order to (have my script) learn when a document or a book got closed.  The code line that I inserted in oldScript.jsx was:

 

Notification(Constants.FA_Note_PostQuitDoc, Constants.FA_Note_PostQuitBook);          // Register for notifications

 

I also added a stub for handling the notification callback.  I didn't get far enough to write the callback code.

 

I added oldScript.jsx to the C:\Program Files (x86)\Adobe\AdobeFrameMaker10\startup folder and started FrameMaker.  After deciding that I no longer wanted to register for any notifications, I removed the registration line above (and the callback handler stub) and renamed the script to newScript.jsx (and put it in the startup folder after deleting oldScript.jsx from the startup folder).  Now I get the following message anytime a document or book gets closed:

 

Notification Error : Can not open file. "C:\Program Files (x86)\Adobe\AdobeFrameMaker10\startup\oldScript.jsx

 

Any idea how to unregister for notifications so that I no longer clog up my console with instances of the above error message.  Note that oldScript.jsx is no longer in the startup folder.  Some persistent entity associated with FrameMaker (or perhaps Windows?) has retained the notification registration that I'd like to kill.  Any help short of reinstalling FrameMaker would be greatly appreciated.

 

Regards,

Paul


insert inset in anchored frame

$
0
0

I cannot find the info on how to insert an Inset into an existing AFrame using ExtendScript. Does anyone have experience with this?

 

Thanks

 

Jang

Create new Unanchored Frame not working?

$
0
0

Hi everyone.

 

What i am trying is creating an empty frame for graphics.

i´m using Extendscript for this purpose. I can create Frames with Graphic. but no empty Frames.

I Tried following code:

                                        
frame = doc.NewGraphicObject (Constants.FO_AnchoredFrame, doc.TextSelection);               
frame = doc.NewGraphicObject (Constants.FO_UnanchoredFrame, doc.TextSelection);               
frame = doc.NewUnanchoredFrame (doc.TextSelection);        

 

None of those is creating an empty Frame. I have an unstructered Document but tried this with structered documents too.

I tried them one by one, and now i am out of options. I don´t have a clue why this is not working.

I´m using Framemaker 12.

 

Hope somebody knows what i´m missing.

Is there some example for creation a TOC for a FM Document?

$
0
0

I have some ElmScript and want to turn that into an Extendscript, but i have some problems with it.

 

This is the ElmScript Function.

 

Sub IHV_Ebene1;   If fslVersionMajor < 3      MsgBox 'Ben'+vsoe+'tigt Framescript Version 3 oder neuer';      LeaveSub;   EndIf     Set PlatformEncodingMode = True;   If ActiveDoc = 0      MsgBox 'Kein aktives Dokument';      LeaveSub;   EndIf     Set gvSrcDoc = ActiveDoc;   GlobalVar gvDocName;   If gvSrcDoc.Name.Count > 0      Set gvDocName = gvSrcDoc.Name;   Else      Set gvDocName = gvSrcDoc.Label;   EndIf     New Book File ('tempXXXX.book') NewVar(gvBookVar);     New BookComponent BookObject (gvBookVar) NewVar(gvBookComp);     Set gvBookComp.BookComponentType = BkNotGeneratable;   Set gvBookComp.Name = gvDocName;     New BookComponent BookObject(gvBookVar) NewVar(gvTocBookComp);     Set gvTocBookComp.BookComponentType = BkToc;   Set gvTocBookComp.Name = gvDocName+'.TOC';     New StringList NewVar(gvExtractList) Value('Ueberschrift 1 Seite BildSeite') Value('Ueberschrift 1') Value('Ueberschrift 1 mehrzeilig BildSeite');     Set gvTocBookComp.ExtractTags = gvExtractList;   Set gvTocBookComp.GenerateInclude = True;   Set gvTocBookComp.InsertLinks = True;     Generate Bookfiles BookObject(gvBookVar) Visible;     Open Document File (gvDocName+'.TOC') NewVar(docobj) ReturnStatus(gvErrorList) Visible;       Open Document File ('O:\Fachanwendungen\Vorlagen\FM9_TOC\ti_toc_ohne2_9.fm') NewVar(QuellDok);    Import Formats DocObject(docobj) FromDocObject (QuellDok) RefPage;   Set ActiveDoc = QuellDok;   Close Document;     Generate Bookfiles BookObject(gvBookVar) Visible;     Close Book  BookObject(gvBookVar) IgnoreMods;     Set ActiveDoc = docobj;   Get Object DocObject(docobj) Type(PgfFmt) Name('Inh-Text') NewVar(NeuFormat1);   Set vPgf = docobj.FirstPgfInDoc;   Loop While(vPgf)      If vPgf.Text <> '<$paranum>\t<$paratext>';         If vPgf.Name = 'Ueberschrift 1IVZ'            Set vPgf.Properties = NeuFormat1.Properties;         EndIf         If vPgf.Name = 'Ueberschrift 1 Seite BildSeiteIVZ'            Set vPgf.Properties = NeuFormat1.Properties;         EndIf         If vPgf.Name = 'Ueberschrift 1 mehrzeilig BildSeiteIVZ'            Set vPgf.Properties = NeuFormat1.Properties;         EndIf      EndIf      Set vPgf = vPgf.NextPgfInDoc;   EndLoop     Set vPgf = ActiveDoc;   Set vPgf.TextSelection = vPgf.FirstPgfInMainFlow.TextRange.Begin;   Set vPgf.CurrentPage = vPgf.FirstBodyPageInDoc;     If vPgf.CurrentPgf = 0     MsgBox 'Keine Einfügemarke';   EndIf     Execute FC CsrTop;   Execute FC HighFlowEnd;     Copy Text;     Close Document IgnoreMods;     Set ActiveDoc = gvSrcDoc ;   Set vPgf = ActiveDoc;   Set vPgf.TextSelection = vPgf.FirstPgfInMainFlow.TextRange.Begin;   Set vPgf.CurrentPage = vPgf.FirstBodyPageInDoc;     If vPgf.CurrentPgf = 0     MsgBox 'Keine Einfügemarke';   EndIf     set vPgf = ActiveDoc.FirstPgfInDoc;   Loop While(vPgf.Name<>'Inh-Ueberschrift')      //Display vPgf.Name;      Set vPgf = vPgf.NextPgfInDoc;   EndLoop     //Display 'Text: '+vPgf.Text;   Execute Fc CsrTop;   Execute Fc CsrNextBop;   Execute Fc CsrNextBop;     Paste Text;     //MsgBox 'Inhaltverzeichnis generiert'  

EndSub

 

 

And This is what i came up with so far:

 

function IHV_Ebene1()
{         var srcDoc = app.ActiveDoc;    var docName;    if(srcDoc.Name != "")    {            docName = srcDoc.Name;    }    else    {            docName = srcDoc.Label;    }    var gvBookVar = app.NewNamedBook("tempXXXX.book");    var gvBookComp = gvBookVar.NewSeriesBookComponent(0);       gvBookComp.BookComponentType = Constants.FV_BK_NOT_GENERATABLE;    gvBookComp.Name = docName;       var gvTocBookComp = gvBookVar.NewSeriesBookComponent(0);      gvTocBookComp.BookComponentType = Constants.FV_BK_TOC;    gvTocBookComp.Name = docName+".TOC";      var gvExtractList = ["Ueberschrift 1 Seite BildSeite", "Ueberschrift 1", "Ueberschrift 1 mehrzeilig BildSeite"];       gvTocBookComp.ExtractTags = gvExtractList;    gvTocBookComp.GenerateInclude = true;    gvTocBookComp.InsertLinks = true;       gvBookVar.SimpleGenerate (false, true);      var docObj = OpenFile(docName + ".TOC", true, true, false, true);    var QuellDok = OpenFile("O:\\Fachanwendungen\\Vorlagen\\FM9_TOC\\ti_toc_ohne2_9.fm", true, true, false, true);    docObj.SimpleImportFormats(QuellDok, Constants.FF_UFF_REFPAGE);    app.ActiveDoc = QuellDok;              app.ActiveDoc.Close(Constants.FF_CLOSE_MODIFIED);       gvBookVar.SimpleGenerate (false, true);    gvBookVar.Close(Constants.FF_CLOSE_MODIFIED);      app.ActiveDoc = docObj;    var NeuFormat1 = docObj.GetNamedPgfFmt ("Inh-Text");    var newProps = NeuFormat1.GetProps();    var mainflow = docObj.MainFlowInDoc;    var tframe = mainflow.FirstTextFrameInFlow;    var vPgf = tframe.FirstPgf;    while(vPgf.ObjectValid())       {         if (vPgf.GetText(Constants.FTI_String) != "<$paranum>\t<$paratext>")         {             if (vPgf.Name == "Ueberschrift 1IVZ")             {                 vPgf.SetProps (newProps) ;             }             if (vPgf.Name == "Ueberschrift 1 Seite BildSeiteIVZ")             {                 vPgf.SetProps (newProps) ;             }             if (vPgf.Name == "Ueberschrift 1 mehrzeilig BildSeiteIVZ")             {                 vPgf.SetProps (newProps) ;             }         }        vPgf = vPgf.NextPgfInDoc;    }           var oPgf = docObj.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;        var oTLoc1 = new TextLoc ( oPgf, 0 );        var oTLoc2 = new TextLoc ( oPgf, Constants.FV_OBJ_END_OFFSET );        var oTRange = new TextRange ( oTLoc1, oTLoc2 );        app.ActiveDoc.TextSelection =oTRange;        app.ActiveDoc.CurrentPage = app.ActiveDoc.FirstBodyPageInDoc;    // If vPgf.CurrentPgf = 0
 //    MsgBox 'Keine Einfügemarke';
 //  EndIf        Fcodes([FCodes.CSR_TOP, FCodes.HIGH_FLOW_END]);        app.ActiveDoc.Copy(Constants.FF_COPY_TO_CLIP);        docObj.Close(Constants.FF_CLOSE_MODIFIED);          app.ActiveDoc = srcDoc ;                     var tRange1= new TextRange();               tRange1.beg.obj = app.ActiveDoc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;        tRange1.beg.offset = 0;        tRange1.end.obj = app.ActiveDoc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;        tRange1.end.offset = Constants.FV_OBJ_END_OFFSET;        app.ActiveDoc.TextSelection =tRange1;        app.ActiveDoc.CurrentPage = app.ActiveDoc.FirstBodyPageInDoc;  // If vPgf.CurrentPgf = 0  //   MsgBox 'Keine Einfügemarke';  // EndIf             mainflow = app.ActiveDoc.MainFlowInDoc;        tframe = mainflow.FirstTextFrameInFlow;        vPgf = tframe.FirstPgf;        while(vPgf.Name != "Inh-Ueberschrift")        {            vPgf = vPgf.NextPgfInDoc;        }        Fcodes([FCodes.CSR_TOP, FCodes.CSR_NEXT_BOP, FCodes.CSR_NEXT_BOP]);          app.ActiveDoc.Paste(Constants.FF_PASTE_CLIP_TEXT);       if(DEBUG) alert("IHV_Ebene1");    }

 

Right now it runs without any error messages. But i don´t get the TOC as wanted. It´s inserting some empty space.

I can see it opening an book and the new TOC File with importing refpage. Then i see him selecting the first row of the TOC File(which is empty btw..?!? ) and trying to paste it.

how to re-size a overflow text frame based on the text length?

$
0
0

Hi ..

Is it possible to re-size a overflow text frame based on the text length?

How to find a text in the Frame maker document via script?

$
0
0

How to find a particular text in the Frame maker document via script?

Viewing all 888 articles
Browse latest View live