Skip to main content
Egan Solo
Inspiring
November 17, 2016
Question

Can I do this with FrameMaker ExtendScripting?

  • November 17, 2016
  • 9 replies
  • 1518 views

Using FM 12.0

I'm a coder so coding is not the issue here. It's just my lack of familiarity with FM ExtendScript and the art of the possible.

I want to create a script that

  1. Inserts a marker of a custom type called Editorial Changes. We can safely assume that this marker type (Editorial Changes) exists already.
  2. Displays an advanced marker window: Please see the mock-up window below. Studying sample scripts such as SnpCreateCheckBoxRadioButtons.jsx, I know I can create something like that window, so that's not an issue.
  3. Once the user has finished filling the fields, I want to capture the data and store it inside the marker field, say as an XML snippet.
  4. Later on, when a user selects a created marker of type "Editorial Changes," I want my script to intercept that event, grab the XML content from the marker and display my custom window with all these fields.

Does the sequence outlined through steps 1-4 doable via an ExtendScript? If you've done something like that and have a script lying around, would you mind sharing?

Thanks!

This topic has been closed for replies.

9 replies

frameexpert
Community Expert
Community Expert
November 17, 2016

Note also that FrameMaker markers have an internal limit of 255 characters. I am not sure if this has changed in later versions, but you should test this before you get too far into development.

www.frameexpert.com
Egan Solo
Egan SoloAuthor
Inspiring
November 17, 2016

Thank you so much for your guidance, FrameExpert, especially in regards to the size of the marker. That's a great pointer. I might then create an auxiliary file to store the content in it and reload it into the window based on a marker id. To your point though, figuring it out if there is a notification for markers will be the greatest hiccup. I'll download the latest sdk. I'll report back as soon as I make some progress into this.

frameexpert
Community Expert
Community Expert
November 19, 2016

Another suggestion would be to use a reference page to store the content. If you have a named reference page with a text frame with a named flow and autoconnect turned on, new reference pages will automatically be created as content overflows the reference page. That would make all of your data self-contained in the file so you won't need an auxiliary file.

www.frameexpert.com
frameexpert
Community Expert
Community Expert
November 17, 2016

There are a bunch of events triggered by FrameMaker, but I don't know if there is one that is specifically triggered when a marker is selected. There are a couple of general purpose events like:

Constants.FA_Note_BackToUser

Constants.FA_Note_PreFunction

Constants.FA_Note_PostFunction

Here is a general shell for setting up notifications. In this example, the script is looking for a paste event to happen, which is 803. I figured out the 803 by setting up the event and monitoring the iparam value as I copied/pasted text and objects.

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

   

    var doc;

   

    // Handle the event triggered after a function is performed.

    switch (note) {

    

    case Constants.FA_Note_PostFunction:

        // Look for paste function.

        if (iparam === 803) {

            doc = object;

            if (doc.FirstSelectedGraphicInDoc.ObjectValid()) {

                // If the document has a selection, turn off its runaround property.

                RN.turnOffRunaround (doc.FirstSelectedGraphicInDoc);

            }

        }

        break;

    }

}

// Set the notification for after a function is executed.

Notification (Constants.FA_Note_PostFunction, true);

www.frameexpert.com
frameexpert
Community Expert
Community Expert
November 17, 2016

I suggest that you download and install the latest FDK (Frame Developers Kit). The documentation has some examples of events/notifications and how they work. The examples will be in C, but it is fairly easy to translate them to ExtendScript.

www.frameexpert.com