2013-02-18

Code Capture Tool Plugins - An introduction for developers

Plugin introduction

The Code Capture Tool 3.2 (CCT) introduces a new feature plugins. These plugins allows the user to store different info to the clipboard than the standard functions:
  • None
  • Image
  • File Path
A plugin functions as a post-capture hook, and allows you to take the stored image and alter the text of the code stored on the clipboard.

Imgur

Included with the CCT 3.2 is an imgur plugin. This plugin is available if you have LabVIEW 2010 or greater, and returns a URL to a stored image on imgur.com. Imgur keeps the images online if they are viewed at least once every half year. (Thanks to Jordan Kuehn for supplying his code)

Creation

You can add your own plugins from the help window (in the plugins page), or via the context menu on the Clipboard listbox:
Plugin creation
This will open (after a confirmation dialog) a new VI from a template.

Editing

A plugin VI is created and opened. The plugin gets some parameters from the CCT when it's called:
Empty Plugin VI
  • Saved image path
    Path of the captured image file
  • FP Mode
    The capture mode of the frontpanel
  • BD Mode
    The capture mode of the block diagram
  • Snippet
    Whether this is a Snippet enabled image
  • Snippet Version
    The file version of the embedded snippet
  • Snippet Header
    Text of the snippet header
A plugin can use this information to take an action with this image. The plugin should return a Clipboard text, and a Success? status. If Success? is false the end user is informed that the plugin has failed.

Customization

To customize the text in the Clipboard listbox you should edit the Title of front panel, to give the end user more information about your plugin (in the Help dialog) the VI description is used together with the VI icon:
Plugin documentation
An end user can edit your VI directly from the Help dialog, consider locking the BD using a password if you want to prevent that.

Distribution

If you want to distribute your plugins to different installation, you can choose two locations:
  • <vi.lib>\LAVA\_Code Capture Tool\Plugins
  • <LabVIEW Data>\CCT Plugins
Per default LabVIEW shares the second location between LabVIEW versions but not between users, while the first location is LabVIEW version specific, but shared between users.

If you use VIPM for creating a distributable plugin, you should use the first location (VIPM does not support LabVIEW data as a target).

Plugin inspiration

There are endless options with plugins how about this inspiration list:
  • Email image
  • Upload image to Facebook
  • Upload image to FTP
  • Add overlay to image 
  • Upload image to knowledge base
  • ......

2 comments: