LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scripting Help - Remove/change items from a Project

I need some help with scripting. I have a bunch on VIs, such as Main, UI, Data, etc in my project. (These VIs have debugging VIs built in.) I have managed to make a script that changes them slightly before compilation of an exe file. (Removes the debugging VIs) Before modifying the VIs I make backups such as Main_debug, UI_debug, etc in my project. This works fine although I feel like my script is a house of cards.

 

I would like to make a script that uses the backup files to replace the ones I just modified. That is, Main_debug -> Main, UI_debug -> UI, etc. Howver, whenever I try to do this I get an error. I have tried using the method remove items from project and delete, but I always get the error that the operation is not allowed because the VI is in memory. What am I missing?

 

Thanks for your help.

 

Regards,

mcduff

0 Kudos
Message 1 of 18
(1,431 Views)

Yes, that occurs because the non-debug VIs are still in memory even after you remove them from your project.  It is hard to get something out of memory short of closing LabVIEW and letting it cleanup and restarting LabVIEW again.  

 

You can try saving the non-debug VIs into a different name first and then renaming the debug VIs, however, if there is linking to the non-debug VIs the linking will go with them.  But maybe that will solve your problem.

Quentin "Q" Alldredge

Owner, Q Software Innovations, LLC (QSI) | Director, GCentral | Admin, LabVIEW Wiki
Tech Lead, Hill AFB LabVIEW Center of Excellence | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner


Message 2 of 18
(1,395 Views)

Thanks for your suggestions. I may have tried them already but will try again.

 

I've tried copy and replacing the orginal files to no avail and deleting them also without luck.

 

You can try saving the non-debug VIs into a different name first and then renaming the debug VIs

 

This is a good suggestion, which I haven't tried before.

 

however, if there is linking to the non-debug VIs the linking will go with them.

 

To relink correctly I have used the following

 

Snippet.png

 

however, I only found this VI on the forums, I have no idea how to browse for it manually. Do you have any idea where it is located on the pallettes?

 

Cheers,

mcduff

 

0 Kudos
Message 3 of 18
(1,371 Views)

If vi is in memory, then either of the following:

vi reference has not been closed after you edited vi (and editing vi is still open).

front panel is open

vi is loaded as sub vi (some top level vi is open).

If everything is closed, vi should not be in memory and you should be able to do whatever you want with vi - overwrite it, delete it, etc.

0 Kudos
Message 4 of 18
(1,368 Views)

I had a somewhat related problem where I was modifying a VI that had massive amounts of dependencies and took forever to load.  However, most of the dependencies were in VIs that were in cases that I didn't need to call to test the modifications I was making.  

 

So what I did is I created some "empty" VIs with the same connector panes as the SubVIs that contained the vast majority of the dependencies that I didn't need.  I put the extension "_SHELL" on those VIs to indicate they were empty shells and "_REAL" on the actual VIs I was keeping out for testing purposes.  

 

The attached VI had no problem swapping them out or swapping them back.  It's pretty close to your problem where you have "Main" and Main-debug".  You can examine how I did it and see if you can modify it.

Message 5 of 18
(1,365 Views)

- Press Ctrl+Space Bar and type Invoke node:
https://zone.ni.com/reference/en-XX/help/371361H-01/glang/invoke_node/

 

Edit: Programming->Application control palette

Thanks
uday
0 Kudos
Message 6 of 18
(1,363 Views)

I know how to get an invoke node, however, I cannot find that particular one when you browse for it

 

Thanks

mcduff

0 Kudos
Message 7 of 18
(1,354 Views)

I know how to get an invoke node, however, I cannot find that particular one when you browse for it

The blue header indicates it's a private method, so it's hidden and you can't get to it. As suggested, the preferred option is to recursively traverse the hierarchy from the top level VI down (using the VI's Callees[] property) and then do save as from the bottom up (and I would suggest once more over all VIs at the end in case you have weird dependencies). Also, if you have VIs in libraries be sure to save those.

Source: From  http://forums.ni.com/t5/LabVIEW/rebuild-quot-save-instrument-and-callers-quot-Scripting/m-p/3227238/...

Thanks
uday
Message 8 of 18
(1,346 Views)

Thanks. What is strange is that on my system, not sure why, the invoke method has a yellow header for that particular call.

 

mcduff

0 Kudos
Message 9 of 18
(1,343 Views)

You can create it, but only if you know the exact name:

1. Place an Invoke node

2. Change its class to a "VI" type

3. Select it so that it and only it is highlighted

4. Press control-spacebar to bring up the "Quick Drop" window

5. Type "Save.Instrument and callers debug" exactly with no quotes, don't press enter and don't care that it doesn't show on the list

6. Press Control-Shift-B

 

Voila! 

 

(Also, did you check out the VI that I attached above yet?)

Message 10 of 18
(1,340 Views)