DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

splitting up FileDlgFileName

Solved!
Go to solution

Hello everyone... quick question here....

 

I have a list of *.TDMS files within FileDlgFileName, which I am then saving in a different directory as *.DAT files. My question is, how do I take the file name out of FileDlgFileName (ie, remove the path and extension).

 

thanks!!!!!

 

Tom

0 Kudos
Message 1 of 4
(4,050 Views)

Just to add to my question, here's some code... the problem I'm having is FileDlgFile is only the name of the last file out of the selection of files I want to convert.

 

Thanks 🙂

 

Tom

 

 

Option Explicit  

Dim MyFileNames
Dim name
Dim iCount
Dim path
Dim J
Dim numberofchannels

Call DataDelAll

'name of files to use
Call FileNameGet("ANY", "FileRead", DataReadPath, "TDMS data (*.tdms),*.tdms", "All.lst", True, "Data selection")
MyFileNames = Split(FileDlgFileName,"|")
'MyFileNames2 = Split(FileDlgFileName

'path to save in
path = PathNameGet("Folder to save data in")

path=OutPutPath

For iCount = 0 To Ubound(MyFileNames)
  
  'open tdms
  Call MsgBoxDisp("loading TDMS file "& MyFileNames(iCount),"MB_NOBUTTON", "MsgTypeNote", 0, 0, 1)
  Call DataFileLoad(MyFileNames(iCount))
  Call MsgBoxCancel() 'close box

  'save as DAT
  Call MsgBoxDisp("saving CSV file" & path & FileDlgFile & ".CSV","MB_NOBUTTON", "MsgTypeNote", 0, 0, 1)
  Call DataFileSave(path & FileDlgFile & ".CSV","CSV")
  Call MsgBoxCancel() 'close box

 ' Call DataDelAll
Next

 

 

0 Kudos
Message 2 of 4
(4,048 Views)

AHA!!!!!    

 

ReturnValue = NameSplit(String, Type)

 

sorted 🙂

0 Kudos
Message 3 of 4
(4,044 Views)
Solution
Accepted by topic author xxxtomxxx

Hello Tom,

 

to extract the name out of FileDlgFileName you can use the command

 

FileNameSplit(<FileDlgFileName>, "N")

 

Please refer to the help to get more information's.

 

Greetings

Walter

0 Kudos
Message 4 of 4
(4,042 Views)