Popular Post vugie Posted December 6, 2010 Popular Post Report Share Posted December 6, 2010 Name: Scripting Sandbox (RCF Plugin) Submitter: vugie Submitted: 06 Dec 2010 File Updated: 03 Jan 2011 Category: VI Scripting LabVIEW Version: 8.2 License Type: BSD (Most common) Scripting Sandbox RCF Plugin Copyright © 20010, Wojciech Golebiowski (vugie) All rights reserved. Author: Wojciech Golebiowski (w_golebiowski (at) tlen [dot] pl) Name: Scripting Sandbox Type: Right Click Framework Plugin LabVIEW version: 8.2 Description Scripting Sandbox is a simple Right-Click-Framework plugin for quick creating and using of flexible scripting VI's without implementing additional RCF plugin. In other words it's a plugin for making plugins which you don't want to distribute, but rather to use internally for work automation in quick and dirty way without any error handling etc. You simply define a directory for storing so called SandScript VIs. RCF menu is being updated according to the content of this directory. SandScript VI has to follow provided template. When you invoke certain script, RCF simply passes whole current "Active VI" cluster to it (VI state, panel and diagram references, array with selected objects and mouse position) Installation Preferably use VIP package and VI Package Manager. Alternatively download ZIP, extract to \resource\JKI\RCF\Plugins\ and restart RCF Examples Few example SandScript VIs are included in Scripts subdirectory. To see them working, copy them to your scripts directory (defined within RCF plugin options) Support If you have any problems with this code or want to suggest features: please go to lavag.org and Navigate to LAVA > Resources > Code Repository (Certified) and search for the "Scripting Sandbox" support page. Version History 1.0.0: Initial release of the code. 1.0.0.3: Not savable SandScript VI bug fixed 1.0.0.4: Some docs updated License (BSD) Copyright © 2010 Wojciech Golebiowski All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Click here to download this file 4 Quote Link to comment
vugie Posted December 6, 2010 Author Report Share Posted December 6, 2010 I wonder who clicked green "+" without even downloading the code... (download counter is still 0). Anyway, whoever did it, thank you Quote Link to comment
jcarmody Posted December 6, 2010 Report Share Posted December 6, 2010 Wasn't me, but I've seen descriptions that were cool enough in themselves to warrant a rep point. Quote Link to comment
Antoine Chalons Posted December 7, 2010 Report Share Posted December 7, 2010 I wonder who clicked green "+" without even downloading the code... (download counter is still 0). Anyway, whoever did it, thank you It maybe because the person first downloaded it from NI community and then rated it here on LAVA... just a wild guess The RCF Plugin is really cool vugie! One thing that bugs me a little though is that when I create a new plugin by using the context menu option "New Sandbox VI" the VI generated is in the JKI.LV.Extentions context and therefore not savable... wouldn't it be easier to place the new plugin in the main application context? I guess it is possible to choose the context in which you create a VI, but I was wandering how do you create your own context programmatically? Quote Link to comment
vugie Posted December 7, 2010 Author Report Share Posted December 7, 2010 One thing that bugs me a little though is that when I create a new plugin by using the context menu option "New Sandbox VI" the VI generated is in the JKI.LV.Extentions context and therefore not savable... wouldn't it be easier to place the new plugin in the main application context? I guess it is possible to choose the context in which you create a VI, but I was wandering how do you create your own context programmatically? Strange, I have no problems with saving VIs created that way. I have never dive deep into context related issues. I remember that there were some problems with RCF's context. Any suggestions what should I wire to Application input of "New VI" block? Now there is a This Application constant. Quote Link to comment
Antoine Chalons Posted December 7, 2010 Report Share Posted December 7, 2010 Strange, I have no problems with saving VIs created that way. I have never dive deep into context related issues. I remember that there were some problems with RCF's context. Any suggestions what should I wire to Application input of "New VI" block? Now there is a This Application constant. Hmmm... this is weird indeed, I have only tried in LV 8.6 and I can't save the new sandbox VI... I think the best way is to use the "main application context" because my experience is that working into other "hidden" context creates problems (like the VI is not runable but you can't have the error list, etc...) I'm not sure what's the best way to get this context's ref though... Here's my first sandbox plugin "Horizontal align and distribute nodes" (saved in LV 8.6) it's quick and dirty but I'm happy with it and it took me about 10 minutes to make it... If I had tried to make a proper RCF for that I would have given up before the end. And this is why the scripting sandbox is really cool! great job Horizontal align and distribute.vi Quote Link to comment
asbo Posted December 7, 2010 Report Share Posted December 7, 2010 I'm not sure what's the best way to get this context's ref though... Will the default app instance work? You can pull an app instance from a VI ref, but from inside the RCF I expect it would return the JKI.LV.Extensions context. Quote Link to comment
vugie Posted December 7, 2010 Author Report Share Posted December 7, 2010 Will the default app instance work? You can pull an app instance from a VI ref, but from inside the RCF I expect it would return the JKI.LV.Extensions context. Thanks, asbo. Antoine, try to replace following VI: [fix is now integrated in latest build] However in my environment plugin VIs report to work in Main Application Instance... Quote Link to comment
Antoine Chalons Posted December 8, 2010 Report Share Posted December 8, 2010 Thanks, asbo. Antoine, try to replace following VI: LINK (what &^%$ is with uploading?!) However in my environment plugin VIs report to work in Main Application Instance... cool, works great ! Quote Link to comment
vugie Posted December 8, 2010 Author Report Share Posted December 8, 2010 cool, works great ! Good. I integrated the fix in new build. Quote Link to comment
vugie Posted December 27, 2010 Author Report Share Posted December 27, 2010 I added documentation for script template (as BD comments). Does anyone know how to set default directory for save dialog? Just for convenience when creating new script - dialog would automatically point to scripts directory. Quote Link to comment
ShaunR Posted December 27, 2010 Report Share Posted December 27, 2010 I added documentation for script template (as BD comments). Does anyone know how to set default directory for save dialog? Just for convenience when creating new script - dialog would automatically point to scripts directory. The Dialog Express VI has a start path. Quote Link to comment
vugie Posted December 27, 2010 Author Report Share Posted December 27, 2010 The Dialog Express VI has a start path. I didn't explain it well... From the start. Sandbox has defined "scripts" directory which is scanned to find installed scripts (by script I mean a VI where Active VI data is passed to). There is "New Sandbox VI" option which automatically creates new script from the template. It is a new unsaved VI, just like after clicking vit file. After creating the script you want to save it, but by default save dialog starts at directory of previously saved VI (or sth like this). So you have to remember where your scripts directory is and search for it. It may be a pain when it is located somewhere deep, so it is in conflict with "quick&dirty" paradigm of Scripting Sandbox. Summarizing, I'm programatically creating new VI for edit and I want to have specified directory in save dialog when user presses Ctrl-S Quote Link to comment
ShaunR Posted December 27, 2010 Report Share Posted December 27, 2010 I didn't explain it well... From the start. Sandbox has defined "scripts" directory which is scanned to find installed scripts (by script I mean a VI where Active VI data is passed to). There is "New Sandbox VI" option which automatically creates new script from the template. It is a new unsaved VI, just like after clicking vit file. After creating the script you want to save it, but by default save dialog starts at directory of previously saved VI (or sth like this). So you have to remember where your scripts directory is and search for it. It may be a pain when it is located somewhere deep, so it is in conflict with "quick&dirty" paradigm of Scripting Sandbox. Summarizing, I'm programatically creating new VI for edit and I want to have specified directory in save dialog when user presses Ctrl-S IC (I think ) If you don't mind being platform dependent then you can use the windows SetCurrentDirectory function (LV example here). But your scripting thingy would still have to be running after they decided to save it. Other than that, I only think if saving a dummy VI after they have saved theirs (again your thingy needs to be running to monitor the memory list). But if your going the platform specific route I would suggest adding it to the places bar so they can always find it easily. Quote Link to comment
Mark Balla Posted September 15, 2011 Report Share Posted September 15, 2011 Certified 9-15-2011 Placed in VI Scripting Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.