01-30-2020 03:00 PM
I know how to do it in VBA using the Scripting File System Object, but nothing I've found in LabVIEW can do this. I found a forum post on running VBScript in an ActiveX control called "MSScriptControl.IScriptControl" from way back in LV 8, but I don't (appear to) have that in LabVIEW 2016.
Is there another way to accomplish it in native LabVIEW? If not, how do I get this "IscriptControl" control?
Thanks,
Erik
Solved! Go to Solution.
01-30-2020 04:09 PM
There are some instructions on how to do this down the thread you linked: https://forums.ni.com/t5/LabVIEW/Use-VBS-in-labview/m-p/2546249/highlight/true#
Does that not work for you? It does in 2018 for me.
01-30-2020 04:35 PM
Argh - I didn't scroll down through the ticket far enough. I was hoping to find a native LabVIEW solution, but this was enough to get it to work.
01-30-2020 04:48 PM
For what it's worth, I didn't see anything in the LabVIEW primitives, LabVIEW hidden gems, the MGI library, nor the OpenG library, so it sounds like this is your quickest solution for now. You might find another package on VIPM that had it.
01-30-2020 05:12 PM
You mean something like this?
01-31-2020 07:24 AM
@Frozen wrote:
You mean something like this?
Very nice. Here's a variant.
01-31-2020 12:20 PM
Thanks for digging. I guess since there's the API options, NI didn't create something of their own. And since I work exclusively in Windows, the VBScript will work.
01-31-2020 12:54 PM
If you did need it to run on multiple OS's, you can use a Conditional Disable Structure with the "OS" symbol to identify your OS. It will return Linux, Mac, null, PharLap, VXWorks, or Win. You could also use the "TARGET_TYPE" symbol, which returns Windows, FPGA, Embedded, RT, Mac, Unix, PocketPC, or DSP.
01-31-2020 01:03 PM
Very nice - Still not a LabVIEW/NI built-in function of course, but since it's WindowsAPI it'd work for me, except for my particular goal is to ID what kind of drive a file is on, and listing the Drives collection won't work if the file is on the network but not on a mapped drive (a UNC path, e.g. "\\Server\Share\FolderA\FolderB\..."). Sorry I didn't state that explicitly in the original post. Fortunately the VBScript version handles that (and even garbage sent as the input File/Folder with no extra coding required). Here's the code (also attached for LV 2016+):