npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@extendscript/ind.util.menuloader

v1.0.1

Published

A tool to load InDesign menus.

Downloads

5

Readme

menuloader

version

InDesign Utility

A tool to load InDesign menus.

Install


    npm install @extendscript/ind.util.menuloader

Use

1. Include


    #include 'node_modules/@extendscript/ind.util.menuloader/menuloader.js'

2. Load


    // Load the module by creating a reference.
    var Menuloader = Sky.getUtil("menuloader")

3. Define menu

Options

  • path (Array, Optional)
    • Path to main menu, leave undefined for InDesign's main menu
  • sub (Array, Optional)
    • The template's submenu. (menuItems)
  • loc (LocationOptions, Optional)
    • Location option for path or ref below.
  • ref (menuItem, Optional)
    • A reference menu item (Defaults to lastItem())
  • fun (Function, Optional)
    • The action for main menu (path). Used when sub is undefined

    // Load the template with the options defined
    var myMenu = new Menuloader.template( menuName, Options );

If you can define the sub menu in your options or use the templates build in functions.

  • addElement (Param elementTemplate)
    • Add element to sub menu
  • createItem (Param caption, fun, subName)
    • Creates an elementTemplate for type menuItem
  • createSeparator (Param subName, Optional)
    • Creates an elementTemplate for type menuSeparator

myMenu.addElement( myMenu.createSeparator() )

3. Load


    // Load the menu into InDesign's Main menu
    myMenu.load();

Unloading

To remove your menu call `myMenu.unload()` 

If you lost the reference to your original template you can unload the menu by creating a new template (You don't need to define the sub menu's) just the name and path to menu:


    var unloadMenu = new MenuLoader.template("My Menu", {path: "File"});
    MenuLoader.unload(unloadMenu);

Note that if you have the reference to the loaded menu you can also call unloadElement which will unload any menuElement it is given:


    Menuloader.unloadElement(menuElement)

Test

We can test the code against a range of targets:

npm run test myTarget

We keep a log of test results

More info

Read the docs