Skip to main content
Participating Frequently
July 17, 2018
Question

Alert Function

  • July 17, 2018
  • 1 reply
  • 854 views

Hi All,

Is the description of the alert function given in the Adobe FrameMaker Scripting Guide, release 2017-01-31, always up to date?
For any type value in the range from 0 to 5, only OK button is shown.

The example of alert function js code shown below use always and only OK button.
The syntax of alert function in this example uses three parameters : message, title and  type.
It is good to know that the message parameter allows to define a title for the alert box.
But is the third type parameter always read and used by alert function?

...

var alertname = "Update all Text-Insets in a FM Template";

// If the active document is  valid then ...

if (doc.ObjectValid() == true)

  {

      ti = doc.FirstTiInDoc; 

      while (ti.ObjectValid () == 1)

          { 

          ...

          }

    alert ("Script execution is completed!\nAll Text Insets have been updated.", alertname, Constants.FF_ALERT_CONTINUE_NOTE);

  }

else

  {

    alert ("No FM Template file is selected.", alertname, Constants.FF_ALERT_CANCEL_DEFAULT);

  }

...

Do you have any opinion or applicable and useful documentation on this subject?

JM

This topic has been closed for replies.

1 reply

Klaus Göbel
Legend
July 17, 2018

Hi JM,

you better have a look at "Javascript Toolsguide" page 111.

alert()

confirm()

and prompt().

It's explained in detail.

Participating Frequently
July 17, 2018

Thanks Klaus,
Yes, older (2010) Adobe Javascript Toolsguide is more accurate than their latest Scripting Guide dedicated to FrameMaker.
JM

Legend
July 17, 2018

Hi JM,

I think you are confusing the native Javascript alert() with the FM Extendscript Alert()  (capital A). Only Alert() has the parameters that you mention. But there should be only two, so I think a sample call would be something like:

Alert ("Script execution is completed!\nAll Text Insets have been updated.", Constants.FF_ALERT_CONTINUE_NOTE);

...that is, I don't know why you put 'alertname' in there.

A little bit of background... this function is a carryover from the FDK function F_ApiAlert(). With the FDK, there are no native alert boxes so the kit included a few like this. With JavaScript, we now have some native language tools available that can replace the FDK versions. But in this case it is easy to get mixed up. It is this way, though, because by convention, the ES developers apparently just removed "F_Api" from all functions to adapt to ES, so this is consistent with the rest of the migration.

Russ