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

Cannot access text insets in a doc

$
0
0

Windows 7 / FM 11 / ESTK CS6 / ExtendScript 4.2.12

 

I am trying to perform a pretty simple task--iterating over the docs in a FrameMaker book and converting all text inset instances to their pathnames--but it won't allow me to access the text inset objects using FirstTiInDoc and NextTiInDoc.

 

For example, the code snippet is:

 

var book = app.ActiveBook;

var doc = book.FirstComponentInBook;

while (doc.ObjectValid())

{

var inset = doc.FirstTiInBook;

while (inset.ObjectValid())

{ /*inset processing*/

inset = inset.NextTiInBook;

}

doc = doc.NextBookComponentInDFSOrder;

}

 

I *know* there are text insets in the documents, a combination of external FM files and plain ANSI text files, all sourced and resolvable without issues. But ExtendScript just isn't assigning the Text Inset objects from .FirstTiInBook. It also throws an exception if I try to use ObjectValid() on an undefined variable (this might be the correct behaviour, please let me know if it is).

 

Am I using FirstTiInBook wrong somehow? The above snippet is lifted almost verbatim from Adobe script examples.

 

Many thanks,

 

JR


Issue While trying to add folder to book using FDK11.

$
0
0

Hi,

i am trying to create folders in a .book file using FDK11. However, i am not able to do so as i am getting parentId as null. I have taken help from the samples that is provided during FDK installation but no use. Can anyone help me to create folders for .book file using FDK11?

facing issue while trying to add folder to book using FDK11

$
0
0
hi12:26 PM
hi, i m facing issue while trying to add folders to a .book. Here's what i have done.
I have created a book

bookName=F_StrCopyString((StringT)"E:\\Createbook\\input\\test.book");
newbookId=F_ApiNewNamedObject(FV_SessionId,FO_Book,bookName);

and added a chapter to it.

StringT chapName=F_StrCopyString((StringT)"E:\\Createbook\\input\\b_cli.fm");
elemId = F_ApiNewSeriesObject(newbookId,FO_BookComponent,0);
F_ApiSetString(newbookId, elemId, FP_Name,chapName);
if(F_StrLen(chapName)) {
F_ApiDeallocateString(&chapName);
}

After adding the chapter , I am calling the following function to create part:

F_ObjHandleT FM_InsertFolderComponentInBook ( F_ObjHandleT bookId, F_ObjHandleT parentId, StringT compName)
{
F_ObjHandleT partId;
F_ElementLocT elemLoc;
IntT fileCount = 1;

if ( !parentId )
parentId = F_ApiGetId ( FV_SessionId, bookId, FP_HighestLevelElement );
elemLoc.parentId = parentId;
elemLoc.childId = 0;
elemLoc.offset = 0;
partId= F_ApiNewBookComponentOfTypeInHierarchy ( bookId, compName, FV_BK_FOLDER, &elemLoc);
return partId;
}


However, part is not getting generated as parentId is comming null. Can anyone please help me create folder component in a .book using FDK11?
I am  facing this issue if i am scripting using FDK11 but in FDK 10,its running fine. Is this an FKD11 library issue or i am missing anything in the code.
Kindly help.

.

How can I find out on which page of a document an Xref can be found using ExtendScript?

$
0
0

Hi,

 

I want to find out on which page of a document an external XRef can be found. Is there a simple way to manage that using ExtendScript? The equivalent in FrameScript is XRef.Page.PageNumString.

 

Thank you in advance.

OT: Beginning FrameMaker Scripting Webinar

$
0
0

Hello Framers,

 

I will be doing a Beginning FrameMaker Scripting Webinar on

 

Tuesday, January 15, 2013 at 11:00 am EST

 

Every FrameMaker workflow can benefit from automation. Starting with version 10, FrameMaker has built-in ExtendScript scripting support. If you have ever thought about FrameMaker automation, this is the webinar to attend. We start with the very basics so you can decide if scripting is for you. If you are a FrameScript user, let me know, and we will provide examples in both languages.

 

The webinar is free and will go for about an hour. If you would like to attend, please send me an email to rick@rickquatro.com or rick@frameexpert.com.

 

Rick

 

Rick Quatro

Carmen Publishing Inc.

585-283-5045

rick@frameexpert.com

How to search text in the table?

$
0
0

Suppose, I've selected some fragment in my document, and I need to find and replace some text in it. Everything is ok, untill I select a part of a table with this text. Does anyone has idea, how to search through the selected cells in the table? Or, just how to iterate them?

 

Thanks!

SHIFT \ RETURN, and TAB space for find/replace array

$
0
0

So right now i have a simple script that will go through a document and find words/characters and replace them with something else. Right now it loops through the document trying to find words in one array and replace them with the text of a second array.

 

How would I add in tab spaces for alignment and then a new line return?

For example, how do I tell it to replace "Text One" with (SHIFT \ RETURN, "Some Text", TAB space, "More Text")

 

Specifically I need it to work like this

 

----script----

agencies = ["Account", "Department", "Department 2", "Department 3", .......];

newagencies = ["Accountancy Board", (SHIFT \ RETURN, "Department", TAB, "#2"), (SHIFT \ RETURN, "Department", TAB, "#3") ];

 

----results----

Account. Department 2 Department 3

 

Accountancy Board
Department          #2

Department          #3

 

 

any help at all would be great.

No u with ChangeStyles script installed

$
0
0

I've run into a very odd bug after installing the ChangeStyles script mentioned in the latest Technical Communication blog post.

 

With the script installed, I cannot type a lowercase letter u in FrameMaker. I can type an uppercase U, but not lowercase. I don't think it's my keyboard, because the problem started immediately after installing the script and no other applications are affected. After I removed the script, the problem is gone.

 

I hope this gets fixed - this script would be useful.

 

Regards

Keith


Batch.bat unable to generate PDFs with FM11 trial version & Elmsft 5.2 trial

$
0
0

Hi,

 

I am evaluating the trial version of Fm11 and FrameScript 5.2 (Elmsft) to generate PDFs using a Batch.bat file. I am able to generate stand alone PDFs with FM11. Now, I have created a Batch.bat file which calls BooksToPDF.fso and a filelist.txt, which contains the list of .book files. This script should work to generate PDFs. This is not working, the script is unable to open FM11 trial version, error message reads: "unable to connect to FrameMaker-open FrameMaker manually". Can anyone help?

 

Is there any other way to generate multiple PDFs in one go with Fm11.

 

Regrads,

Himani

Script needed asap to rename linked graphic folder path name in FM11

$
0
0

Hello,

 

I am using FrameMaker 11 in the Technical Communication Suite 4 and I am looking for a script that can "hopefully" take care

of these two issues.

 

Here they are:

 

  1. I need to rename the linked FrameMaker 11 graphic paths in a folder full of FrameMaker files.  For example, I need to change:   \FrameMaker Book\Graphics\ 
    to:  \FrameMaker_Book_A\Graphics_Catalog\
  2. I have already renamed all the graphics using the script below, but now need a script that will update to the new graphic file path and new graphic file name, using a two column table.

 

So, to make it simple, the FrameMaker script would open the two columns (for example in a FrameMaker table in a stand-alone file), and then search out (like a Windows Grep) for the old file path and old graphic file path, find the old path and then come back to that FrameMaker table and insert the new file path and graphic name from the second column in that FrameMaker table.

 

Next, the script would go down to the next FrameMaker entry down in the first column and repeat the process until it is done.

 

http://windowssecrets.com/forums/showthread.php/108928-Two-part-Macro- needed-for-batch-file-renaming-(Excel-2003-SP3)

 

 

Sub RenameFiles()

' Modify as needed but keep trailing backslash

Const strPath = "C:\Temp1\"

Dim r As Long

Dim n As Long

n = Cells(Rows.Count, 4).End(xlUp).Row

For r = 5 To n

Name strPath & Cells(r, 4) As strPath & Cells(r, 5)

Next r

End Sub

 

 

The code above does a fanstastic job (in Excel) at renaming thousands of graphics, but I now need a script (preferably in FM without having to save out to MIF) that will find the old graphic and old graphic path in a folder full of documents and then reference a FrameMaker file (or Excel file if needed) and do the line for line swap all the way down the column rows.

 

If nothing comes up, I will have to do it by hand (grunt work) and I really do not have the luxury of time, at the moment.  Besides, why do something by hand when an automated script can do it for you...

 

Thanks in advance for any ideas.

 

Regards,

 

JIm



How to enter Escript world

$
0
0

Hello friends!

 

I face a strange hurdle at the entrance tothe Escript world:

- Running existing scripts out of FM (10 or 11) is possible via File > Scripts, select a script and Run it.

- Opening the ToolKit, opening the script and trying to run it (green triangle) , issues the message:

Canot execute script
Target Adobe Framker 10 (10.0) provides no engine for debugging.

 

I have cut this down to the most basic 'script':

ESTK.png

Klicking on the red (broken) link button makes it gray - not green as it is when selecting ExtendScript Tookit CS6 from the drop down list.

When this is selected, the 'scipt' runs and displays the message box.

 

What is wrong with my connection between FM and the ESTK?

 

Klaus Daube - definetely new to the subject

Need ExtendedScript to change paragraph formats

$
0
0

Hi

 

We are migrating our old courses into a new FrameMaker template. As part of this process, we have to change the content with old paragraph formats to new paragraph formats as well. For example, content with paragraph tag "Bullet1" in the old course should be changed to "ListBullet1" paragraph format in the new course.

 

I am aware of two approaches for this task.

1.  Open each FM file and use Global Update feature to update the each format at file level.

2.  Use Paragraph Tools shareware plug-in from Silicon Prairie to update the each format at book level.

 

 

We have 70+ paragraph formats to be converted. So, is there a ExtendedScript to do this task?

ExtendScript and CMS

$
0
0

Is the FrameMaker CMS functionality exposed to ExtendScript? If so, is there any documentation or sample scripts available? Thanks in advance.

 

Rick Quatro

How to verify if a document is updated?

$
0
0

Hi, How would I select a page based on it's id ?

 

To set the scene ; I'm running a couple of scripts to allow me to update a conversion table on the fly. This all works fine, but I'd like to check if my original conversion table is updated or not using extendscript. The result could then trigger next steps, as for instance structuring the book if the conversion table didn't change, or give a warning message in case it was changed.

 

This is what I have :

 

// UpdateConvTable() is called from within another function, and is used for any document in a selected book

// convTableId is global variable storing the docID of my conversion table

 

function UpdateConvTable(doc,name){

 

var docId = doc.id;

CallClient("Structure Generator", "SourceDocId " + docId);

CallClient("Structure Generator", "UpdateTable " + convTableId);

 

// missing magic here

 

var params = GetSaveDefaultParams();

var returnParamsp =new PropVals();

var i = GetPropIndex(params, Constants.FS_FileType);

params[i].propVal.ival =Constants.FV_SaveFmtBinary;

 

doc.Save(name, params, returnParamsp)

return

}

 

The 'missing magic' part I want to replace with a quick check to see if the conversion table is actually updated or not. I assume I can do this with the DocIsModified statement, but I can only find examples using the active document (if(app.ActiveDoc.DocIsModified) { some code here} ) , but I'm stuck on getting it working with a document that's not active (but on screen). It works fine selecting the doc manually, it returns true if modified and false if not, but I want to do this on a doc based on it's id.

 

So something like if(convTableId.DocIsModified) {some code here} , but that would have been to easy :-)

 

Anybody that can help me with the correct syntax ?

[FM10] Some support needed with book save as XML

$
0
0

Hi there,

 

I'm in a process to convert loads of old non structured FM manuals into structured formats, and though it all works fine there is a lot of repetition involved I'd like to get rid off. I'm having a bit of experience with extendscript for indesign, but the documentation for FM is rather poor. So if someone can get me started or provide some codesnippets to make my job a bit more pleasant it would be highly appreciated :-)

 

My processes :

 

First I open a book, and for each file I run the 'Generate conversion Table' command. The missing paragraph tags need to be added to an existing Conversion table called 'conversion_table'.

 

Question 1 : Can I use some code to do this automatically ? So all fm files in the book get opened (silent or not does not really matter) , missing tags are added to the existing table, and fm file is closed again.

 

Second : I clean up the conversion table so output is a bit streamlined. That's a manual process anyway so no issues

 

Third : I structure the book using the table. Pretty straight forward also so no problem here

 

Last step : I save all fm files as docbook 2.1 format, but again this requires me to open all fm files one by one, select 'save as XML', select docbook as format and save the file itself.

 

Question 2 : Can I also here use some code so all fm files in the book are opened, saved as XML using docbook format , and closed again with me leaning back and looking at my PC doing the dirty job for me. To push my luck it would be great if I could also integrate step 3

 

 

I guess all of this would be rather simple for a seasoned programmer, but I'm cracking my teeth on it. Therefore anybody that can point me in the right direction or provide some code that could get me running would make my day for sure

 

Thanks in advance!

K.


Adding Character Tag based on used Font Family

$
0
0

Hi there,

 

There are quites some examples available on changing existing styles etc, but is it possible to add them using extend script if they are not added yet ?

 

Example :

 

I'm having quite some frame documents using for instance [symbol] as font. Normally spoken all strings in my file that use symbol should have the symtag character tag, however for some it's missing and that's causing issues when structuring my documents. symtag is just a fictional name for a charactertag in my catalog.

 

So what I'd like to achieve is the following :

 

1) Open document

2) traverse through document, and for each character using symbol as a font, check if it's having the symtag character tag, if not, add it.

3) save and close

 

1) and 3) are easy enough (well, sort off...) , but I can't find anything on how to make 2) work, I'm not even sure it's possible with extendscript to start with.

 

If it might simplify things, it's always just a single character that is using the font(s) in question.

 

Thanks in advance for anything that can get me started !

Script needed to generate a list of paragraph and character styles from the Book Level

$
0
0

Hello,

 

I am using FrameMaker 11 in the Adobe Technical Communication Suite 4 and I need to find a script that will generate a list

of paragraph and character styles from the book level.

 

I am working with unstructured FrameMaker books, but will soon be looking at getting a conversion table developed
that will allow me to migrate all my data over to Dita (1.1 for now).

 

Any thoughts, ideas on this is very much appreciated.

 

Regards,

 

Jim

Get Table Continuation Variable from Table Title

$
0
0

Hi,

 

I have a table object, and I've determined that the table has a title by finding a valid FirstPgf object.

 

Now I want to check that FirstPgf object to see if the system variable, Table Continuation, is there.

 

I suspect this involves getting the paragraphs text items, specifically the constant FO_Var. But I don't know how to do it.

 

Thanks for the advice.

 

Jason

FDK - Add custom modeless dialog to workspace

$
0
0

(cross-posted to framedev and Framers, having no luck getting an answer)

 

Hi,

 

Has anyone successfully added their own dialog to a workspace, then gotten it to

appear when that workspace is selected or reset? The FDK doc implies that this

can be done, but I can't figure it out. I open my dialog box, save the

workspace, but it doesn't come back when I reset the workspace.

 

I actually did not expect that to work, because there has to be some other hook

where I respond by executing the proper code to launch the box. FM couldn't know

what that code would be. But, I can't figure out how to work the notifications.

In particular, I can't figure out FA_Note_Dialog_Create at all.

 

Thanks,

Russ

How can I catch a keyboard input and return another character to Framemaker?

$
0
0

Hi,

 

I want to catch an keyboard input and return another character to Framemaker, like e.g. changing a "y" I type into my computer into a "z" and vice versa or changing the arrow key "right" into "Tab".

 

For me, the biggest issue in this is to find a solution to catch the keyboard input by ExtendScript for further processing. I tried the Notify-function, but it doesn't seem to work like described in the Scripting Guide and I have no idea how to make it work. I hope that someone here knows a solution for at least the keyboard input issue.

 

Thank you in advance.

Viewing all 888 articles
Browse latest View live


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