08-22-2016 12:59 PM
Hi there,
I'm just making a simple script I can run with my action engines, so if I add new enum values I can create new wrappers quickly. I'm able to create a new VI on disk, but when I try to add the the VI to the library, I get "Error 1562: The specified project or library is locked." Just before adding the item, I tried setting the library state to "Not Locked", but that didn't do the trick.
Directions to see error:
Open attached zip file
Open "Action Engine.lvlib"
Run "Script - Create Wrapper.vi"
Please let me know how to get around this, thank you,
Gregory
Solved! Go to Solution.
08-22-2016 01:08 PM
I don't know about you but when I run it the Owned Items that are returned from the library is empty, so the search 1D array returns -1, and it tries performing operations on a Not a Refnum.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
08-22-2016 01:12 PM
Interesting... I'm running with LV 2012 and the OwnedItems has the 2 virtual folders in it. The For Loop runs twice and the array of Names has the two virtual folder names in it.
08-22-2016 01:24 PM - edited 08-22-2016 01:27 PM
Oh...that's because the save function generated an error for me, which fed into a property node that didn't return the library. This error didn't get propigated because the for loop for me runs 0 times, so the error coming out of the for loop is cleared. You should use a shift register on the errors for the for loop, or index and merge errors. BTW the error the save returned for me was error 1357. This is cause I was running it with the enum on init sorry.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
08-22-2016 01:31 PM
Oh I see, thank you I've taken your instruction. I should have included the enum value in the directions.
08-22-2016 01:38 PM - edited 08-22-2016 01:41 PM
By the way I just remembered I already created this function for creating wrappers. I originally posted it on our user group discussion here.
https://decibel.ni.com/content/thread/32307?tstart=0
This then went into LAVA where development continued, and eventually was able to make a polymorphic VI, that containsed each of the VIG states, and even deleted the controls not used in that state from the front panel, and created a new library setting the VIG to private.
https://lavag.org/topic/19114-create-fgv-wrappers/
The original code posted on the user group worked on your VIG, the newer one on LAVA died with errors from something. It made the files but had issues.
The code isn't perfect but could be used as a starting point if you can't figure out why your code does weird things (I couldn't)
EDIT: It seems the reason the code died is because a case didn't exist for every unique value of the enum.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
08-22-2016 01:59 PM
Thanks for sharing that code! I was also looking at ways to customize the icon, they don't seem to make it easy... The DQMH does a great job with them though.
08-22-2016 11:19 PM
There is at least two reasons a library locks: 1) something it owns is running, 2) it is open in two or more application instances. (This goes for classes too.)
I started a project and took your scripts out of the library (to avoid #1) and then opened your library's reference by path in your script, making sure to include the application reference (to avoid #2).
Works now. (Except for the Init.vi but you stated earlier that you knew about that. But Item 1 and Item 2 work fine.)
Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner
08-23-2016 11:04 AM
Hi TheQ, I am using LV 2012, so I could not view your attachment. Can you explain how to open a library reference by path?
08-23-2016 11:30 AM
Yes, I will post the code saved to LV2012 later, its not here with me.
However, to open a Library reference by path:
1. Drop an invoke node
2. Write a application reference into it (not usually necessary but when trying to avoid case #2 as I mentioned earlier)
3. In the invoke node, click and select Library --> Open
4. Wire as input the path to your Library, the output will be the reference to your library.
Because the Script VI was saved in the same folder as the library, I created the path by getting the Script VI's Path, stripping the VI filename off and building the library's filename onto the path.
The only other edits I made was to make sure the same application instance was wired to New VI Scripting Function and to move all the script files out of your library.
Again, I'll repost the code when I can. Hope this helps.
Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner