LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scripting: Move a VI into a Virtual Folder

Solved!
Go to solution

OK, here's the situation:

 

  • I have a Project.
  • Inside is a Class.
  • I used a Provider Framework method to create an Override method in the Class of one of its parent methods
  • By default, that VI is at the root of the class, but I would much prefer it to be in a virtual folder
  • I created the virtual folder
  • Now I'm stuck. What scripting method(s) are required to move the VI into the Virtual Folder?

I tried the ProjectItem methods "AddItem" and "AddFile" and "AddItemFromMemory", but those failed because the Item already exists in the class library.

 

Anyone out there done this before and can point the way?

 

0 Kudos
Message 1 of 5
(559 Views)
Solution
Accepted by topic author 10Things_Rob

There is a "ProjectItem" method called "Move", but it's hidden by default:

 

Kyle97330_0-1745267296913.png

 

You can make this (and a LOT of other stuff, most of which you won't need) visible by changing your LabVIEW.ini file to include this line:

SuperSecretPrivateSpecialStuff=True

 

Alternately, to add it without changing your INI file:

1. Drop an invoke node for the ProjectItem class on one of the other methods (any). 

2. Make sure it and nothing else is selected on the block diagram.

3. Press control-space to bring up Quick Drop

4. Wait for a bit if this is the first time you have opened it

5. Type in "Move"

6. Press Control-Shift-B

 

It should then alter that invoke node to be a "Move" method.

 

Message 2 of 5
(549 Views)

Hi,

 

Sure, there is the private ProjectItem method "Move":

raphschru_0-1716818803368.png

To be able to select it, add this key to your LabVIEW.ini and restart LabVIEW:

SuperSecretPrivateSpecialStuff=True

 

As long as the move does not provoke a namespace change, this should be sufficient.

 

If it does (by moving the vi in or out of a library, or from one library to another), things can get more complicated because manual dialogs asking to save callers may appear. Here are the details of a workaround I had found:

https://forums.ni.com/t5/LabVIEW/Programmatically-move-project-item-without-dialog/m-p/4375174

 

Regards,

Raphaël.

Message 3 of 5
(540 Views)

Thanks!

 

Any chance you have a tricksy way of converting from a VI refnum to a ProjectItem refnum?

 

What I did was close the VI, then traverse the Project to get the class, then look inside the class to get the Method. Seems kinda like there should be an easier way...

 

-- Rob

 

0 Kudos
Message 4 of 5
(470 Views)

@10Things_Rob wrote:

Any chance you have a tricksy way of converting from a VI refnum to a ProjectItem refnum?


raphschru_2-1745400680490.png

0 Kudos
Message 5 of 5
(431 Views)