Jump to content

Save As... on running VIs


Recommended Posts

Starting in LabVIEW 8.0, the File>>Save As... menu option was disabled on running VIs. However, you could still open a VI Server reference to a running VI and invoke the Application.Save method to effectively perform a Save As operation. Now, in 8.2, it is no longer possible to invoke the Application.Save method on VIs that are running in any application instance, including NI.LV.Dialog, which is used for VI launched by the menu (Tools menu, for example). Attempting to do this in LabVIEW 8.2 produces an error (Error 1507. Possible Reason(s): LabVIEW: Cannot change the name or path of a VI in its current state. Method Name: SaveInstrument). I have to wonder whether there was some good reason for this (besides protecting us from ourselves). This new limitation actually prevents some cool things that we were doing with OpenG Builder -- specifically, its ability to build parts of itself at first launch.

Link to comment
Starting in LabVIEW 8.0, the File>>Save As... menu option was disabled on running VIs. However, you could still open a VI Server reference to a running VI and invoke the Application.Save method to effectively perform a Save As operation. Now, in 8.2, it is no longer possible to invoke the Application.Save method on VIs that are running in any application instance, including NI.LV.Dialog, which is used for VI launched by the menu (Tools menu, for example). Attempting to do this in LabVIEW 8.2 produces an error (Error 1507. Possible Reason(s): LabVIEW: Cannot change the name or path of a VI in its current state. Method Name: SaveInstrument). I have to wonder whether there was some good reason for this (besides protecting us from ourselves). This new limitation actually prevents some cool things that we were doing with OpenG Builder -- specifically, its ability to build parts of itself at first launch.

I think the following workaround should do the thing:

- Write an independent VI (SAVE.vi) that can handle saving of the project

- Start main VI, if you want to build the project

- dynamically create a copy of SAVE.vi and all the VIs that you need for saving process (easiest is to use a library and call save as method)

- call the transient copy SAVE.vi with state parameter that describes in what state your progrman was prior to build, don't wait it to exit

- exit everything else

- SAVE.vi builds the project and re-executes the main VI

- delete transient copy of SAVE.vi

That's it, quite complicated compared to your previous solution, I admit.

Link to comment
Starting in LabVIEW 8.0, the File>>Save As... menu option was disabled on running VIs. However, you could still open a VI Server reference to a running VI and invoke the Application.Save method to effectively perform a Save As operation. Now, in 8.2, it is no longer possible to invoke the Application.Save method on VIs that are running in any application instance, including NI.LV.Dialog, which is used for VI launched by the menu (Tools menu, for example). Attempting to do this in LabVIEW 8.2 produces an error (Error 1507. Possible Reason(s): LabVIEW: Cannot change the name or path of a VI in its current state. Method Name: SaveInstrument). I have to wonder whether there was some good reason for this (besides protecting us from ourselves). This new limitation actually prevents some cool things that we were doing with OpenG Builder -- specifically, its ability to build parts of itself at first launch.

Doing "save as" on a running VI has always been an thread-unsafe operation. The fact that it has worked so often in the past is the Grace of God and the fact that few users have dual CPU or multicore CPUs. With the introduction of LVClasses, we had a situtation that where runtime save as would almost always crash. Couple that with the increased number of dual core and dual CPU machines, and it was more than time to do something -- either prevent runtime "save as" or make "save as" be thread safe. The latter would be preferrable from your point of view but it turned out to be technically infeasible when a couple of developers investigated it. So the error.

Link to comment
  • 1 month later...

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.