Batch/mass-convert EDAT3 files to CSV

Comments

4 comments

  • Avatar
    David McFarlane

    Well that Python script certainly is an interesting find.  I suppose one might adapt it to work with edat3 files.  As far as I can tell, little or nothing has changed in the edat file format from 2 to 3, other than changing the file extension from edat2 to edat3.

    Other than developing your own software tool to do the mass conversion, you might have to convert each file individually using E-DataAid 3.  Might turn out to be the same amount of labor either way, but it might help the community if you developed the batch conversion tool and released it.

    0
    Comment actions Permalink
  • Avatar
    Dennis Thompson

    I wrote a simple Windows PowerShell script to automate the conversion of edat to csv.

    # Dennis Thompson UC Davis Imaging Research Center
    # Escape Path Delimiters
    # Remember to add Delimiter to end of path
    # ControlFile is used by E-DataAid to control the command line conversion
    # Location where ControlFile will be written
    $ControlFile='C:\\temp\\Nback_Megan\\ControlFile.txt'
    # Where to write output files
    $OutPutLoc='C:\\temp\\Nback_Megan\\converted\\'
    # Where RAW edat files are located
    $EdatLoc='C:\\temp\\Nback_Megan\\'
    # Filter used to select files
    $EdatFilter='*.edat2'
    # E-DataAid Location
    #$DataAid='C:\Program Files (x86)\PST\E-Prime 2.0\Program\E-DataAid.exe' 
    $DataAid='C:\Program Files (x86)\PST\E-Prime 2.0\Program\'
    # DataAid Options
    $Options='/e /f'


    $files=get-childitem $EdatLoc -include $EdatFilter -name

    ForEach($infile in $files){
        # get the base name of the edat file
        $foo = $infile.split(".")
        $newname = $foo[0]
        # output name of file being converted
        echo $infile
        $strings=@()
        $strings+="Inheritance=NULL"
        $strings+="InFile=$EdatLoc$infile"
        $strings+="OutFile=$OutPutLoc$newname.csv"
        $strings+="ColFlags=1"
        $strings+="ColNames=1"
        $strings+="Comments=1"
        $strings+="BegCommentLine="
        $strings+="EndCommentLine="
        $strings+="DataSeparator=,"
        $strings+="VarSeparator=,"
        $strings+="BegDataLine="
        $strings+="EndDataLine="
        $strings+="MissingData=NaN"
        $strings+="Unicode=0"
        $strings | Set-Content -Path $ControlFile
        #Get-Content -Path $ControlFile
        start-process "E-DataAid.exe" -ArgumentList "$Options $ControlFile" -Wait -WorkingDirectory "$DataAid"
        $filedata = Get-Content "$OutPutLoc$newname.csv"
        #$filedata[4..($filedata.length - 1)] | sc "$OutPutLoc$newname.txt" -Encoding ASCII
        $filedata[4..($filedata.length - 1)] | Set-Content -Path "$OutPutLoc$newname.csv"

    }

     

    1
    Comment actions Permalink
  • Avatar
    Dennis Thompson

    Oh this is the E-Prime 2 version . But I have used it with E-Prime 3 files. 

    0
    Comment actions Permalink
  • Avatar
    David McFarlane

    Very nice -- I never thought about running E-DataAid as a command-prompt program.  Now I see that this is documented at https://support.pstnet.com/hc/en-us/articles/360020316014-INFO-Using-E-DataAid-exe-with-Command-Line-Interpreters-25323-

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk