How to pull a variable's value from a doc using ExtendScript

Scott Prentice sp10 at leximation.com
Tue Jul 15 13:22:20 PDT 2014


Hi Adam...

You'll need to get the variable definition value from a document in the 
book, not the book itself, so you'll need to set up some process to 
iterate through the book components and get an appropriate document 
(perhaps the first  non-generated component?). Once you get the document 
you can open it and query it for the value of the variable definition 
using something like this ..

     var doc = app.ActiveDoc;
     var varFmt = doc.GetNamedObject (Constants.FO_VarFmt, "Issue Number");
     var varValue = varFmt.Fmt;

If you haven't already, you'll want to grab the samples graciously 
provided by Russ from West Street Consulting ..

http://www.weststreetconsulting.com/WSC_ExtendScriptSamples.htm

Good luck!

...scott

Scott Prentice
Leximation, Inc.
www.leximation.com
+1.415.485.1892

On 7/15/14 12:51 PM, Adam Hollett wrote:
>
> Hey there!
>
> I'm a technical writing student just getting my feet wet in a work 
> placement. One of the things I've been doing is trying to improve the 
> workflow here and cut down on repetitive tasks.
>
> To that end I've created an ExtendScript which grabs the most recent 
> version of each of our 18 FrameMaker documents and saves them as PDFs 
> in a network folder.
>
> All of our books feature an 'Issue Number' variable which indicates if 
> there have been any revisions to the document since the last product 
> release. The issue number is featured in the output PDF's file name. 
> Right now the script contains a record of each issue number which it 
> inserts, but this must be updated manually any time the FrameMaker 
> files are updated.
>
> The script iterates through the list of books that I have, opens each 
> book and saves it as a PDF. What I would like to have it do is grab 
> the value of the 'Issue Number' variable from each book just before it 
> is saved and include that number in the filename, rather than the 
> number which is currently manually specified as a book property in the 
> array of FrameMaker documents.
>
> This is my first time using JavaScript or ExtendScript. Google has 
> been helpful with scripting but I haven't been able to Google this 
> particular issue because any search I make that includes the word 
> 'variable' inevitably gives me results discussing JavaScript or 
> ExtendScript variables rather than specifically FrameMaker variables.
>
> Any ES experts out there able to throw me a line?
>
> Thanks,
>
> Adam Hollett
>
> Customer Documentation
>
> Solace Systems
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.frameusers.com/pipermail/framers-frameusers.com/attachments/20140715/aa649e87/attachment.htm>


More information about the framers mailing list