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

Save All Open Files Constant - Exists?

Participant ,
Jun 27, 2019 Jun 27, 2019

Copy link to clipboard

Copied

Hello fellows,

In the Scripting Guide, I don't see such a constant. Is there such a thing?

It is the same as <Shift> + Click File --> Save All Open Files

I need it for an event script. Is there any other way to catch such an event?

BTW, what does Constants.FV_SaveFmtBookWithFm do?

Thanks!

Roman

TOPICS
Scripting

Views

523

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

correct answers 1 Correct answer

Community Expert , Jun 27, 2019 Jun 27, 2019

Hi Roman,

You can use a general script to capture the "number" of a function that doesn't have a specific Notification. Then you can use this number in an event script to capture that event and do what you need to.

#target framemaker

setupNotifications ();

function setupNotifications () {

   

    Notification (Constants.FA_Note_PreFunction, true);

    Notification (Constants.FA_Note_PostFunction, true);

}

function Notify (note, object, sparam, iparam) {

   

    var element, regex;

   

    // Handle the be

...

Votes

Translate

Translate
Community Expert ,
Jun 27, 2019 Jun 27, 2019

Copy link to clipboard

Copied

Hi Roman,

You can use a general script to capture the "number" of a function that doesn't have a specific Notification. Then you can use this number in an event script to capture that event and do what you need to.

#target framemaker

setupNotifications ();

function setupNotifications () {

   

    Notification (Constants.FA_Note_PreFunction, true);

    Notification (Constants.FA_Note_PostFunction, true);

}

function Notify (note, object, sparam, iparam) {

   

    var element, regex;

   

    // Handle the before/after function events.

    switch (note) {

       

        case Constants.FA_Note_PreFunction :

       

            alert ("PreFunction: " + iparam);

            break;

   

        case Constants.FA_Note_PostFunction :

       

            alert ("PostFunction: " + iparam);

            break;

    }

}

It looks like Save All Open Files is 796. So now you can do something like this:

#target framemaker

setupNotifications ();

function setupNotifications () {

   

    Notification (Constants.FA_Note_PreFunction , true);

}

function Notify (note, object, sparam, iparam) {

   

    // Handle the pre-function event.

    switch (note) {

       

        case Constants.FA_Note_PreFunction :

       

            if (iparam === 796) {

                 // Do something before the Save All Open Files function.

            }

       

        break;

       

    }

}

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
Participant ,
Jun 30, 2019 Jun 30, 2019

Copy link to clipboard

Copied

Hi Rick,

Thank you for your valuable input!

I've just recalled that you had shown me this method once.

Best Wishes,

Roman

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 ,
Jun 30, 2019 Jun 30, 2019

Copy link to clipboard

Copied

Hi Roman, Mark my answer as Correct, if you were able to use it. Thanks -Rick

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
Participant ,
Jul 01, 2019 Jul 01, 2019

Copy link to clipboard

Copied

LATEST

Sure, thanks Rick!

Best regards,

Roman

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