Saturday, November 3, 2012

Getting Started with Custom Quick Drop Keyboard Shortcuts

Back when I first introduced Quick Drop Keyboard Shortcuts (QDKS) in LabVIEW 2009, I wrote this blog post that discussed how to write your own shortcuts. That information is still valid (for LabVIEW 2009, anyway), but it's a bit dated, and doesn't quite discuss all the details and functionality available today. Plus, I've been asked several times recently about how to "get started" writing custom QDKS. So this blog post will be a a refresher, along with up-to-date information about what's currently available in LabVIEW 2012 that pertains to QDKS.

Template
There is a plugin template that ships with LabVIEW that you can use to get started writing your shortcut:

[LabVIEW 2012]\resource\dialog\QuickDrop\QuickDrop Plugin Template.vi

Yes, I know it should be a .vit file, and it will be in LabVIEW 2013...but for now, you have to save your own copy somewhere. Anyway, this VI is full of commentary describing how you go about adding the necessary scripting code for your plugin. The template already includes the bookend code necessary to set up an Undo transaction for whatever operation your plugin performs.

File Locations
You can place your plugin VI in one of the following two locations to make it available as a QDKS:

[LabVIEW 20xx]\resource\dialog\QuickDrop\plugins
[LabVIEW Data]\Quick Drop Plugins

If you put your plugin in the LabVIEW 20xx folder, it will only be available in that version of LabVIEW. If you put it in the LabVIEW Data folder, it will be available in any LabVIEW version (2010 and later), as long as you saved it in the earliest LabVIEW version you want to support.

Getting Started
Not sure how to get started actually writing the scripting code for your plugin? The shipping plugins are all fully documented, so you can browse their code for reference:

[LabVIEW 2012]\resource\dialog\QuickDrop\plugins

The Wire All Terminals and VI Server Rename plugins are password-protected because they use private scripting functionality, but the other plugins are available for your perusal. If you need any help writing your plugin, the Quick Drop Enthusiasts group on the NI Community has lots of experience writing shortcuts, and there are dozens of community shortcuts that you can use for reference as well.

Sharing your Shortcut
Once your plugin is ready for prime time, share it with the world! Post it to the Quick Drop Enthusiasts community, and include a link to it on the List of Community Quick Drop Keyboard Shortcuts page.

5 comments:

  1. Darren,
    How does LabVIEW recognize that there are plugins in the [LabVIEW Data]\QuickDrop Plugins folder?

    I ask because I downloaded the Replace or Insert, and want remove the separate Replace and Inserts from my shortcuts list. I put them in a separate folder called Unused Plugins and they still show up. I thought it might be tied to the VI documentation so I cleared them, but they still show up.

    I have plenty of support folders with VIs in them that don't show up as plugins. What's the trick?

    ReplyDelete
  2. Quick Drop looks within both plugin folders (recursively) for .vi files that have a connector pane data type matching the plugin template (resource\dialog\QuickDrop\QuickDrop Plugin Template.vit). If you want to "disable" a valid plugin within either folder, the easiest way would be to rename the .vi file to have another extension (like .bak).

    ReplyDelete
  3. is the "[LabVIEW Data]\Quick Drop Plugins" folder automatically created when labview is installed? i have labview 2011, 2012 and 2013 installed and can't find this folder (even using windows file search on my C drive)

    I would expect the filepath to be as follows:
    C:\Program Files (x86)\National Instruments\LabVIEW Data\Quick Drop plugins
    (or remove (x86), but still isn't there)

    ReplyDelete
  4. The [LabVIEW Data] folder is created in the Documents folder on your OS. For example, I run Windows 7, and mine is at C:\Users\[username]\Documents\LabVIEW Data. This folder is created by the LabVIEW installer, but you'll have to create the "Quick Drop Plugins" subfolder yourself.

    Also, you can retrieve the LabVIEW Data folder programmatically in LabVIEW with the Default Data Directory VI.

    ReplyDelete