Jump to content
News about the LabVIEW Wiki! Read more... ×
Ton Plomp

[LVTN] Code Capture Tool

Recommended Posts

index.php?app=downloads&module=display&section=screenshot&id=63

Name: Code Capture Tool

Submitter: Ton Plomp

Submitted: 03 Jul 2009

Category: LabVIEW Tools Network Certified

LabVIEW Version: 2009

License Type: BSD (Most common)

The Code Capture tool allows you easily create screenshots of you LabVIEW code for use in documentation, web-sites, wikis, emails.

This tool provides an API for creating images of LabVIEW code as well a GUI for easy capturing and use of code.

Further info is provided in the help-screen (F1) of the program.

For the latest version visit the Code Repository

For the latest version of the source code, visit SourceForge

For more info, visit the LabVIEW wiki with the documenation.

A series of videos is available on screencast: Code Capture Tool

Installation

============

To install the Code Capture Tool, run the 'Install Code Capture Tool.vi' in the LabVIEW version of your choice, or use the OGP file in conjunction with VIPM.

A wizard will guide you through the installation procedure.

Usage

============

After installing and restarting LabVIEW, you can open the Code Capture Tool via the 'Tools' menu to capture an image of the current VI.

For more info open the About screen of the GUI.

Uninstalling

============

To remove the Code Capture Tool from your LabVIEW installation remove the following files in your LabVIEW folder:

Project\Code Capture Tool.vi

user.lib\CCT.mnu

And the following folder:

user.lib\_Code Capture Tool

In your LabVIEW data folder (in Windows, this is normally: My documents\LabVIEW Data) is a configuration file called Code Capture Tool.ini, which can be removed at any moment. However this file can be shared between mulitple versions of LabVIEW, I recommand you to use a special LabVIEW data folder for each LabVIEW version.

Contact

============

Comments, bugs and thank yous can be expressed to the NI Forums community , and on the LAVA community at the CCT discussion thread.

Click here to download this file

  • Like 2

Share this post


Link to post
Share on other sites

Hi All,

I am looking for beta testers of a new version of the Code Capture Tool.

Especially people in posession of multiple LabVIEW versions on Mac and Linux.

So if you could sent me a PM with your configuration, I try to respond to you.

Ton

Share this post


Link to post
Share on other sites

I tried to install this from VIPM without success.  VIPM couldn't install it for LV 8.2; 8.6 completed successfully but I got an "Error 7 occurred at Open Config Data.vi" in 8.6.  I went back and ran Install Code Capture Tool.vi in 8.6 and got the same error.  

Without CCT, I'll have to resort to  taking pictures of my monitor to attach to my posts.   :wacko:

Share this post


Link to post
Share on other sites

Hi jcarmody,

what OS are you on?

Do you have read/write privileges on your LabVIEW data folder? Especially the Code Capture Tool.ini file?

Ton

Share this post


Link to post
Share on other sites

what OS are you on?

Do you have read/write privileges on your LabVIEW data folder? Especially the Code Capture Tool.ini file?

Windows XP

Yes

Share this post


Link to post
Share on other sites

I tried to install this from VIPM without success.  VIPM couldn't install it for LV 8.2; 8.6 completed successfully but I got an "Error 7 occurred at Open Config Data.vi" in 8.6.  I went back and ran Install Code Capture Tool.vi in 8.6 and got the same error.  

Could you run the Install Code Capture Tool.vi on 8.2?

I have tested the OGP file on Vista for all versions I currently have (7.0-2009)

Windows XP

Yes

Will try to check that later.

I will sent you an edited version privatly.

Ton

  • Like 1

Share this post


Link to post
Share on other sites

I just tried Install Code Capture Tool.vi on 8.2 without success.  I've attached a screen capture of the result.  A small window flashes after a slight pause, before the error message comes up.  Perhaps that's a clue to what's happening?

I tried the version you sent privately, but it didn't change anything.  Perhaps I'll wait a few days to see if other folks with XP have the same trouble I'm having.  I'd hate to have you spend time fixing something that isn't broken on your end.

Thanks.

cct.swf

Share this post


Link to post
Share on other sites

I just tried Install Code Capture Tool.vi on 8.2 without success.  I've attached a screen capture of the result.  A small window flashes after a slight pause, before the error message comes up.  Perhaps that's a clue to what's happening?

I tried the version you sent privately, but it didn't change anything.  Perhaps I'll wait a few days to see if other folks with XP have the same trouble I'm having.  I'd hate to have you spend time fixing something that isn't broken on your end.

Thanks.

I was able to replicate the problem you have (on XP)

Trying to debug...

Ton

Share this post


Link to post
Share on other sites

Run the attached VI.Openrwconfig.vi

This will open the BD of the VI with the bug.

Delete the input wire of the 'Open Config VI.'

post-2399-125942223277_thumb.png

The next release will have this fixed.

Ton

Share this post


Link to post
Share on other sites

Version 2.0.5 has been released fixing the 'error 7' bug.

Ton

Share this post


Link to post
Share on other sites

Here's a demonstration video with the new (2.0) features:<br/>

<object width="360" height="554"> <param name="movie" value="http://content.screencast.com/users/TonPlomp/folders/Default/media/4a988906-a72a-41f4-a978-35e68c0f2d20/CCT2.0_controller.swf"></param>'>http://content.screencast.com/users/TonPlomp/folders/Default/media/4a988906-a72a-41f4-a978-35e68c0f2d20/CCT2.0_controller.swf"></param> <param name="quality" value="high"></param> <param name="bgcolor" value="#FFFFFF"></param> <param name="flashVars" value="thumb=http://content.screencast.com/users/TonPlomp/folders/Default/media/4a988906-a72a-41f4-a978-35e68c0f2d20/FirstFrame.png&containerwidth=360&containerheight=554&showstartscreen=true&showendscreen=true&loop=false&autostart=false&color=1A1A1A,1A1A1A&thumb=FirstFrame.png&thumbscale=45&content=http://content.screencast.com/users/TonPlomp/folders/Default/media/4a988906-a72a-41f4-a978-35e68c0f2d20/CCT2.0.mp4"></param> <param name="allowFullScreen" value="true"></param> <param name="scale" value="showall"></param> <param name="allowScriptAccess" value="always"></param> <param name="base" value="http://content.screencast.com/users/TonPlomp/folders/Default/media/4a988906-a72a-41f4-a978-35e68c0f2d20/"></param>'>http://content.screencast.com/users/TonPlomp/folders/Default/media/4a988906-a72a-41f4-a978-35e68c0f2d20/"></param> <embed src="http://content.screencast.com/users/TonPlomp/folders/Default/media/4a988906-a72a-41f4-a978-35e68c0f2d20/CCT2.0_controller.swf" quality="high" bgcolor="#FFFFFF" width="360" height="554" type="application/x-shockwave-flash" allowScriptAccess="always" flashVars="thumb=http://content.screencast.com/users/TonPlomp/folders/Default/media/4a988906-a72a-41f4-a978-35e68c0f2d20/FirstFrame.png&containerwidth=360&containerheight=554&showstartscreen=true&showendscreen=true&loop=false&autostart=false&color=1A1A1A,1A1A1A&thumb=FirstFrame.png&thumbscale=45&content=http://content.screencast.com/users/TonPlomp/folders/Default/media/4a988906-a72a-41f4-a978-35e68c0f2d20/CCT2.0.mp4" allowFullScreen="true" base="http://content.screencast.com/users/TonPlomp/folders/Default/media/4a988906-a72a-41f4-a978-35e68c0f2d20/" scale="showall"></embed> </object>

  • Like 1

Share this post


Link to post
Share on other sites

The Code Capture Tool rocks. :thumbup1: I love it. :wub:.  The video was a great touch, too.

Just to be clear (because I can't test it) folks will be able to drag a snippet made with the CCT in LV 8.6 to a LV 2009 BD?  I'm wondering when CCT 3.0 will come out, with the ability to extract the code from a snippet in pre-2009 versions...  :unsure:

Share this post


Link to post
Share on other sites

The Code Capture Tool rocks. :thumbup1: I love it. :wub:.  The video was a great touch, too.

Thanks

Just to be clear (because I can't test it) folks will be able to drag a snippet made with the CCT in LV 8.6 to a LV 2009 BD?

Yes you will, I have created a snippet on Linux 8.2 and imported on Windows 2009

  I'm wondering when CCT 3.0 will come out, with the ability to extract the code from a snippet in pre-2009 versions...  :unsure:

Shouldn't be too hard (yours to try), but the code is embedded inside a PNG tag as a saved VI, just open up and dump like a merge VI.

Ton

Share this post


Link to post
Share on other sites

Shouldn't be too hard (yours to try), but the code is embedded inside a PNG tag as a saved VI, just open up and dump like a merge VI.

Here's a LabVIEW 8.6 VI that takes a path to a snippet-embedded PNG file and creates a snippet.vi in the same folder.  I'm not happy with the way I did it; it works, but I have a feeling that there's a more elegant method.  The next thing I'd like to try is to make a JKI RCF plugin that converts a PNG on the BD into code.  It would be nicer to be able to have LabVIEW respond to a PNG being dropped onto the BD; do you know how I might do that?

Hey folks!  This picture is a Snippet made with the Code Capture Tool in LV 8.6!  :thumbup1: 

post-7534-125971636984_thumb.png 

GetSnippet.vi

Share this post


Link to post
Share on other sites

I am wondering how your code actually works since the snippet is embedded in a 'niVI' chunk preceded by the chunk size.

The snippet is created in 'user.lib\_Code Capture Tool\CCT Class\Software\Methods\Private\Snippet\CCT_Snippet__CCT.vi'

Here is a screenshot of the VI that creates the chunk:

post-2399-125973924913_thumb.png

And I think this code should get the actual snippet (tested):

post-2399-12597399171_thumb.png

Ton

Share this post


Link to post
Share on other sites

[...] the snippet is embedded in a 'niVI' chunk preceded by the chunk size. [...]

Thanks.  I actually had studied the vi that embedded the snippet but took the long way around.  It's much prettier now :).

post-7534-125975673003_thumb.png

GetSnippet.vi

Share this post


Link to post
Share on other sites

 Does it make sense to add this to the end of the VI?  Is there a more appropriate way to open a VI for editing?

post-7534-125977697351_thumb.png

Share this post


Link to post
Share on other sites

You can open the BD of the VI, select the content and (if I'm not mistaken) even copy it to the clipboard.

Share this post


Link to post
Share on other sites

Here's a LV7.1 llb that will extract a snippet made with the CCT, and a snippet to test it with.  Put the llb into [LabVIEW]\project and restart LabVIEW to use it.  Put the snippet in a BD, select it and click Tools -> GetCCTSnippet.  Now all I need is for folks to make snippets instead of screen shots...

post-7534-126167426616_thumb.png

GetCCTSnippet71.llb

Share this post


Link to post
Share on other sites

Ton,

The latest version has two issues that I saw:

  1. There's a breakpoint in the installer.
  2. I don't see the snippet image in the CCT unless I drag the empty preview area.

I tested a snippet from LV2010 to 8.2. It worked beautifully. Thanks for the good work.

Jim

Share this post


Link to post
Share on other sites

I have just installed the code capture tool opg package in LV8.5.1 and I am having a problem getting it to capture a selected case in the block diagram of a particular VI. Here is a screen capture of the code-capture front panel. Notice that the Block Diagram options are disabled (grayed out). I am able to get the block diagram selection to work with other higher level VI in this project.

post-850-0-75928600-1289940082_thumb.png

Thanks in advance for any help you can provide

Jim Cardinal

Share this post


Link to post
Share on other sites

The block diagram options should be unavailable if the BD is inaccessible. This can happen if the BD has been removed or if the VI does not have one (like a global VI or a control) or if the VI's BD is locked.

Looking at the code, it looks like there is one bug there - it compares the lock state to 2 or greater which, according to the help, would prevent the BD from being accessible even if it was only locked. The comparison should be changed to greater than 2 (which should only apply to a password protected BD). If this is important to you, you can change it now, as the code is open source.

Share this post


Link to post
Share on other sites

Thanks for the reply. The VI in question is a subVI of a password protected higher level VI. Other that removing the password protection, is there a way to access the BD of the subVI with the code_capture tool?

Jim Cardinal

Share this post


Link to post
Share on other sites

I don't think that being inside another PW'd VI should have affected the VI you're trying to view, so I'm assuming the actual VI is also PW'd.

We did discuss allowing the user to unlock the VI from the CCT at one time, but I was against it, because I didn't want to overload the CCT with more functionality. I believe you should be able to use the CCT to capture the BD if you simply unlock the VI before calling the CCT. If you want to automate this, the VI class should have a method you can call to unlock the VI, but you'll need to provide the password.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

By using this site, you agree to our Terms of Use.