DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

retreive path of selected file

Hi all,
 
I need to obtain the path of a file currently selected in Navigator in a VBS script. Can anybody please give me a hint?
 
Thanks,
 
Stefan

Message Edited by StGl on 05-23-2006 07:58 AM

0 Kudos
Message 1 of 9
(5,034 Views)

Hi Stefan,

If you mean that the user has selected a file in the NAVIGATOR tree view, which looks just like Windows Explorer, then I don't know of a way to help you.  If you meant a searched file record in the ReturnList table in DIAdem 10, or a selected File, Group, or Channel in the Data Portal, then I could help.

How about a nice file dialog for your VBScript?  Or if you want to get really fancy, you could try adding an ActiveX container control to a new SUDialog and trying to fill it with Windows Explorer or Internet Explorer.  I know Internet Explorer behaves fairly nicely in that scenario, but I've never tried Windows Explorer-- I assume there's an ActiveX object for that too.

Regards,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

 

Message 2 of 9
(5,012 Views)
Hi Brad,
 
I'm using a VBScript to automatically read and analyze a set of data files in a certain folder. Currently, I obtain this folder by PathNameGet() - that's working, but it would have been more nice to get the folder from Navigator.
 
The idea was to let the user browse in Navigator to the desired path and then just call the script (Shift- Fxx Key) without having to select the folder again.
 
Anyway - thanks for your reply. I was hoping that there is a system variable or something showing the actual Navigator path. Everything else would be overkill for this small script - I don't want the path selection to be 10 times more code than the "working" part of the script Smiley Happy
 
Regards,
 
Stefan
0 Kudos
Message 3 of 9
(5,003 Views)

Hi Stefan,

I don't know if you are familiar with the customizable context menu in the ResultsList table in DIAdem 10, when you have run a search and are right-clicking on the results of the search.  Anyway, you have the option of inserting your own custom menu items into the context menu that shows up then.  We're looking into the possibility of doing something like that for the regular tree view control in the NAVIGATOR.  No guarantees as to when that might show up, but it would make a lot of feature sense, and I'll bet it would give you what you want.

The idea of having a global variable populated with the currently selected file paths is also a cool one.  I'll pass that along to R&D.

Cheers,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

 

Message 4 of 9
(4,995 Views)

Hi Stefan,

The joke's on me.  I was halfway through my email to R&D when it suddenly hit me that in DIAdem 10 this functionality is already there!  The new NAVIGATOR object variable gives you access to the selected items in the regular NAVIGATOR tree.  Here's the code that already works in DIAdem 10!

Set Elements = Navigator.Display.CurrDataProvider.Browser.SelectedElements

FOR i = 1 TO Elements.Count
  IF Elements(i).IsKindOf(eSearchFile) THEN
    Msg = Msg & i & vbTAB & Elements(i).Properties("fullpath").Value & vbCRLF
  END IF
NEXT
MsgBox Msg

Sorry it took me so long to think of this (and don't tell R&D!),
Brad Turpin
DIAdem Product Support Engineer
National Instruments

 

 

Message 5 of 9
(4,990 Views)
YES! THAT'S IT! Smiley Very Happy
 
Thanks Brad,
 
that's exactly what I was searching for!
 
Stefan
0 Kudos
Message 6 of 9
(4,977 Views)
Hi Brad,
 
unfortunately, I just discovered a big drawback in this solution:
 
It only works for Files already indexed by DataFinder! If you select a data file which is not in the index, the function will return an empty path - even if the file is in a Diadem readable format.
 
Do you have an idea how to extend this functionality to files not in the index? I'm afraid my basic knowledge in VBScript will not be sufficient...
 
Thanks
 
Stefan
0 Kudos
Message 7 of 9
(4,961 Views)

Hi Stefan

Here is a smal modification of Brads script, that works even outside of the search index:

Set Elements = Navigator.Display.CurrDataProvider.Browser.SelectedElements

FOR i = 1 TO Elements.Count
  IF Not Elements(i).IsKindOf(eSearchchannelgroup) And Not Elements(i).IsKindOf(eSearchchannel) THEN
    Msg = Msg & i & vbTAB & Elements(i).Properties("fullpath").Value & vbCRLF
  END IF
NEXT
MsgBox Msg

Winfried

Message 8 of 9
(4,958 Views)

Thanks Winfried,

it's working. Still much to learn for me...

 

Regards

 

Stefan

0 Kudos
Message 9 of 9
(4,953 Views)