Macro for File Export

Have a suggestion for improving DPlot or a question about existing features? Let us know

Moderator: DPlotAdmin

Post Reply
dhousema
Posts: 2
Joined: Tue Jun 01, 2004 3:25 pm

Macro for File Export

Post by dhousema »

Hi,

I have seen in the help how to batch export files to another format, but I'm having some trouble.

I'm trying to export a bunch of nicolet data files that are in subdirectories
such as C:\test\1Jun2004\ch 0\test??\*.wft

I would like to batch export them to a csv files.

Please help

Thank you
dustin
dustin.houseman@atc.army.mil
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

You can't do exactly what you want, but you can come pretty close:

Directory("C:\test\1Jun2004\ch 0")
ForFilesIn("test??\*.wft")
FileSaveAs(2,".csv")
FileClose()
NextFile

This will save the first curve (and only the first) to the same filename with .csv extension. But the file will contain an extra number (the number of points) in the first line.

I'll add support for .csv files (w/o the number of points) to FileSaveAs in the next release. Like the above it will most likely be limited to saving only the first curve. Or I'll add another parameter to save all curves if all curves have the same number of points, same spacing, etc.
Visualize Your Data
support@dplot.com
dhousema
Posts: 2
Joined: Tue Jun 01, 2004 3:25 pm

Thanx

Post by dhousema »

Thank you for the help.

It didn't exactly work how I planned however. The test?? is an individual directory such as test 01, test 02, etc etc. The macro editor seemed to lock up on my machine.

I just edited the macro 15 times or so. and that seemed to work. It would be nice if it could traverse the subdirectories and convert them.

Directory("C:\test\1Jun2004\ch 0\test 15")
ForFilesIn("*.wft")
FileSaveAs(2,".csv")
FileClose()
NextFile
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Ack! Sorry, I was on autopilot when I typed that and it didn't register that your ?? was part of the folder rather than the filename. As you found, that won't work.
It would be nice if it could traverse the subdirectories and convert them.
Yes it would. I'll see what I can do.
Visualize Your Data
support@dplot.com
Post Reply