• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Generate a list of user variables

Community Expert ,
Jul 06, 2023 Jul 06, 2023

Copy link to clipboard

Copied

I have a client who regularly sends documents to translation.

When the documents are returned the user variables tend to be translated inconsistently with former translations. So there is a need to somehow gain control of the user variables and have a list which can be generated and checked and - preferrably - somehow be communicated to the translation agency, so they can assure consistency.

I am unsure how to proceed with this challenge in orderly manner. It seems I am not able to generate a list of variables which would have been nice. What would you do?


Bjørn Smalbro - FrameMaker.dk

Views

111

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 06, 2023 Jul 06, 2023

Copy link to clipboard

Copied

Here is a script that writes the name and definition of each user variable to the Console window. The list is comma-delimited so you can copy/paste it into a file and open it with Excel. Note that if you have budget, we could fancy this up so it writes to a text file or gives you a nicer interface, etc.

 

#target framemaker

main ();

function main () {

    var doc;
    
    doc = app.ActiveDoc;
    if (doc.ObjectValid () === 1) {
        processDoc (doc);
    }
}

function processDoc (doc) {

    var varFmt;
    
    varFmt = doc.FirstVarFmtInDoc;
    while (varFmt.ObjectValid () === 1) {
        // See if this is a user variable.
        if (varFmt.SystemVar === Constants.FV_VAR_USER_VARIABLE) {
            Console (varFmt.Name + ',"' + varFmt.Fmt + '"');
        }
        varFmt = varFmt.NextVarFmtInDoc;    
    }
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 07, 2023 Jul 07, 2023

Copy link to clipboard

Copied

Thank you Rick. I shall give this a look. Not quite shure what to do with this code, though. Save it as a text file with the jsx extension and add it to scripts?


Bjørn Smalbro - FrameMaker.dk

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 07, 2023 Jul 07, 2023

Copy link to clipboard

Copied

LATEST

Hi Bjørn, Yes that should work. After you save it, you can choose File > Script > Run, or add it to the Script Catalog palette.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 06, 2023 Jul 06, 2023

Copy link to clipboard

Copied

Hi,

In the past I had this issue as well. Very annoying. And there are not only user variables, but also cross-reference formats, autonumbering, names of doc types, text on master pages. Additionally your table formats store the paragraphs of the header and the first body row and the table title, and these formats have the source language. The table title might still have Figure as autonumber instead of Abbildung.

Therefore I had written a FrameScript script which looks all this info up in a special FrameMaker file and adjusts all variables and formats.

One of the best scripts which I have!

Now I am rewriting it with ExtendScript.

I can only recommend to develop something similar with your data.

Best regards, Winfried

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 07, 2023 Jul 07, 2023

Copy link to clipboard

Copied

Hi @Winfried Reng Sounds like a nice and useful script. And you are right. I am looking for a kind of workflow solution. Thing is...the client spends an awful amount of time checking up on these translation issues so we need to find a good way of helping the translation agency do their work in a more consistent manner.


Bjørn Smalbro - FrameMaker.dk

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines