Jump to content

Is there a way to programmatically get text from an existing vi's icon and programmatically enter text into a new vi icon?


PatH

Recommended Posts

Well you can get the source of the LabVIEW Icon editor, so you can get the text, and write the output to the icon.

I have never opened the code from the editor, but I assume the text is saved as a tag in the VI's meta-data. However this is not a standard, if you for instance use the Endevo Goop toolkit ( by MikaelH), you are not compatible with the standard NI data.

 

Ton

Link to comment

Sounds great, how do i get access to the VI's meta-data to get the right tag(s) for all the text within the icon. This is the proper way to modify the text :)

 

OCR should be just fine (required vision dev module)

or you can also use a 3rd party or open source  OCR tool which accepts image (icon) as an input and spit out all the characters it finds (normally in a *.dll format - eg. ActiveX or .Net component)

Link to comment
Darren, Im pretty sure the questioner is after a way to programatically get the text field and modify it

 

Yes, and unless I'm misunderstanding the question (and your clarification), the LabVIEW Icon API in LabVIEW 2012 allows you to programmatically retrieve and modify the text layer of the icon.

 

post-4441-0-31648000-1360106376_thumb.pn

Link to comment

Darren,

 

The API will work for all the icons that created by the API only. But it is a pretty good starting point for many people I guess.

Within the LabVIEW Icon API, there is an useful function: Read Icon Data from VI, this will return a cluster of the Icon Data which has stuff like: Body Text (line 1 text, line 2 text ....) font size, font alignment and such.

 

Attached is an example I made to show this.

 

However, this will not work if the icon created by a different API/software eg. MikaelH's GOOP tool or paint or photoshop...If this is the case, we have to use an OCR method to get the texts from the icon.

 

It would be nice if MikaelH'sGoop uses the same type def (or just the Body Text part of the LabVIEW Icon API's Icon typedef) when generating the text field on the Icon, that way MikaelH's GOOP Tool can have access to the Text fields hence modifying/getting/setting of the texts can be unified between his tool and LabVIEW native Icon editor.

 

Might be in the next release of GOOP? any thought Mikael? 

 

post-11757-0-30240200-1360192281_thumb.p

IconStuff.vi

Link to comment
  • 2 weeks later...
Darren, it's a shame the 'Read Icon Data from VI.vi' is password protected, as I'd like this functionality for LV 2010 onwards (as well as the corresponding 'Write Icon Data to Vi.vi' of course :-).

 

There were changes made to the Icon Editor in LabVIEW 2012 to facilitate the addition of the LabVIEW Icon API. Thus, I don't suspect the shipping API in 2012 could be easily ported to past LabVIEW versions. Instead, you can check out the community version of the Icon Editor API here.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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