LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I identify a file location's drive type (hard drive, mapped network drive, etc.)?

Solved!
Go to solution

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

0 Kudos
Message 1 of 9
(3,398 Views)
Solution
Accepted by ErikL68

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.

0 Kudos
Message 2 of 9
(3,360 Views)

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.

0 Kudos
Message 3 of 9
(3,349 Views)

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.

0 Kudos
Message 4 of 9
(3,346 Views)

You mean something like this?

 

Frozen_1-1580425902703.png

 

 

---------------------------------------------
Former Certified LabVIEW Developer (CLD)
0 Kudos
Message 5 of 9
(3,341 Views)

@Frozen wrote:

You mean something like this?

 

Frozen_1-1580425902703.png

 

 


Very nice.  Here's a variant.

"If you weren't supposed to push it, it wouldn't be a button."
Download All
0 Kudos
Message 6 of 9
(3,247 Views)

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.

0 Kudos
Message 7 of 9
(3,200 Views)

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.

0 Kudos
Message 8 of 9
(3,191 Views)

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+):

Get Drive Type VI.png

0 Kudos
Message 9 of 9
(3,179 Views)