Invoke plug-in's menu option via a script

Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / Invoke plug-in's menu option via a script

Viewing 3 reply threads
  • Author
    Posts
    • #94377
      A Zook
      Member

      First some background. I’m new to scripting/programming in general. I’ve got some basics but Javascript and the InDesign DOM has me perplexed most of the time. I apologize ahead of time for the length of what follows, but I hope it better helps you, help me.
      System: Win10
      App: InDesign CC 2015
      plug-in: InTools’ Reflective Objects

      We’ve been using this InTools Reflective Objects plugin to help us with the design of a large catalog. It works pretty well, but we’d like to automate it some more. The plug-in shows up as a menu item with a drop down to choose other actions. It is one of those menu choices that I would like to script and ultimately invoke it when or right after a doc is opened. First, however I would like to get something to work by double clicking a script in my Scripts Panel. That would be a huge step forward for me. So here’s what I have so far.

      Code from InTools pdf manual (2011)
      //The plugin is returned as a single-item array
      var reflectiveObjectsPlugin = doc.loadedScriptedPlugins (“reflectiveobjects”)[0];

      //make sure objects reflect immediately!
      reflectiveObjectsPlugin.handleScriptEvent (“externalReflectObjects”); (This is the actual menu item I want to invoke in a script)

      Here’s some of InTool’s documentation regarding these two lines of code…
      “Besides applying the settings to the objects, the plug-in can be communicated with directly. This is accomplished by sending event handlers to the plug-in. To send an event handler to Reflective Objects you must first get a reference to the plug-in. So if you get a reference to the
      first item of that array you then have a valid reference to Reflective Objects. To further illustrate this point, this line of code (assuming a valid reference to a document) will return a reference to Reflective Objects in javascript:
      var reflectivObjectsPlugin=doc.loadedScriptedPlugins(“reflectiveobjects”)[0] ”
      – and –
      “Once you have a reference to the plug-in, you can then send event handlers to the plug-in. These three event handler codes correspond to the three last menu options under Reflective Objects namely: “Deactivate Reflective Objects”, “Activate Reflective Objects”, and “Trigger Object Reflection”. To send the event handler codes to the plug-in you should do something like this: reflectivObjectsPlugin.handleScriptEvent (“externalReflectObjects”) ”

      So I’ve tried these lines… on their own, in an anonymous function, in an if/then loop, etc and nothing has worked to invoke the menu item. I’m not sure if the 2011 InTools manual is outdated and is giving me incorrect terms. (eg I can’t find what looks to be a method, loadedScriptedPlugins, anywhere in the DOM documentation I’ve been using. Or is the InTools manual assuming I’ll add other code to help facilitate these lines they’ve provided? If it’s the latter, I have no idea where to start. Am I missing declaring some needed variables? Am I missing a loop or event listener or function?

      I really hope someone can shed any light on this problem, because I’m pretty much stuck (and the plugin vendor has not answered support requests yet) Thanks

    • #94824
      A Zook
      Member

      Could someone at least reply? Even a “I/we can’t help you”, would be better than nothing… This seems like an active forum; unless if you ask the wrong question…

      Here’s another question that surely someone knows something about. How do plugins fit into the overall DOM?

      regards, Disappointed

    • #94825
      David Blatner
      Keymaster

      It’s a tricky problem and many plug-in and script developers are in Atlanta this week for the Creative Developers Summit (https://cdevsummit.com) — sounds like you should be here, too, to ask this question! :-)

    • #94826
      A Zook
      Member

      Yeah! I wish. I would love to pick an experience ID scripter’s brain (face-to-face) with some of these questions. But maybe my team and I will learn something better as we slog through it ourselves (all of us being quite new to ID scripting…)

      Thanks David for a reply.

Viewing 3 reply threads
  • You must be logged in to reply to this topic.
>