10-25-2010 09:00 AM
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
Solved! Go to Solution.
10-25-2010 09:38 AM
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
10-25-2010 09:49 AM
AHA!!!!!
ReturnValue = NameSplit(String, Type)
sorted 🙂
10-25-2010 09:50 AM
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