are user defined filenames possible?

Robert Dörr uni at robertdoerr.de
Wed Dec 21 21:10:39 UTC 2005


Ben,

you have to initialize a new DataFile object. Just put the following 
code in an inline script at the beginning of your experiment:

    set c.DataFile = new DataFile
    c.DataFile.Filename = "whatever.txt"

    If FileExists(c.DataFile.Filename) Then
        If ebYes <> MsgBox("WARNING: The data file and/or recovery file 
already exists:\nFILE: " & c.DataFile.Filename &     "\n\nDo you want to 
overwrite?", ebYesNo + ebQuestion) Then
            GoTo ExperimentAbort
        End If
    End If

    c.DataFile.Open
    c.LogHeader

You can spare the "If...End If" part if you want.

Best regards
Robert

Ben Robinson wrote:

> is it possible to get eprime to name the data file using a 
> user-defined string variable, rather than the SubjectID?
>  
> i've tried inserting this code:
> c.DataFile.Filename = CStr(c.GetAttrib("Experiment")) & "-" & 
> CStr(c.GetAttrib("MyOwnStringVariable")) & "-" & 
> CStr(c.GetAttrib("Session")) & ".txt"
> and also tried with this code:
> c.SetAttrib "Subject", c.GetAttrib("MyOwnStringVariable")
>  
> but neither seems to work, since the data file has already been 
> created and named by the time eprime gets around to running my own code...
>  
> any thoughts would be appreciated.
>  
> ben robinson



More information about the Eprime mailing list