|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 2/22/2008 3:53:38 PM
Posts: 3,
Visits: 12
|
|
It would really help me for data processing if e-prime could produce a .txt and .edat with a different filename. Can the script be edited to get around the default?
mac373
|
|
|
|
|
Forum Newbie
      
Group: Awaiting Activation
Last Login: 8/22/2008 4:45:23 AM
Posts: 7,
Visits: 1,154
|
|
It is not very difficult to edit the ebs-script to change the default output filename if you have some knowledge of the E-Basic syntax. Just open the ebs script and look for the line that sets the filename:
c.DataFile.Filename = ...
You can use any valid E-Basic expression to set a customized name. You could even specify a complete output path. For example:
c.DataFile.Filename = "C:\\data\\abc-" & CStr(c.GetAttrib("Subject")) & “.txt”
Note that newer version of EPrime will create two separate variables to set the filenames of both the txt and edat files, so you will have to change both variables to keep them in sync.
Newer versions of eprime also support a new kind of attribute, which allows you to override the default filename (“DataFile.Filename.Override”.) I’m not sure how this could be used though…
Remember that any changes to the ebs script will be lost if you regenerate the script from the original es-file. Therefore it might be useful to use a tool that makes it possible to change the ebs script at runtime each time the script is started. EKick is such a tool and can be downloaded without charge from: http://www.psy.vu.nl/download/menu/xml/eprime_tool_ekick.xml
best,
Paul
Paul Groot
Vrije Universiteit Amsterdam
Paul Groot
VU University Amsterdam, FPP-ITM
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 2/22/2008 3:53:38 PM
Posts: 3,
Visits: 12
|
|
Thanks Paul. This is definitely useful, but even if I customize my filename and directory in the line
c.DataFile.Filename = ...
I still get a .txt and .edat of the same name in the same directory.
Is it possible to edit the script when the .txt is converted to .edat? For example, in the script line
nConvert = c.DataFile.Convert(ebProgressSimple)
is there another method I can use here? Can the name be changed using E-basic once it has been converted into .edat format? Thanks.
mac373
|
|
|
|
|
Forum Newbie
      
Group: Awaiting Activation
Last Login: 8/22/2008 4:45:23 AM
Posts: 7,
Visits: 1,154
|
|
oops, I misinterpret you initial question , so let me try again.
You can simply rename any single file by using the Name function. However, since the conversion of the txt file occurs at the end of the script, you should still put your renaming code manually in the ebs-script below the ExperimentFinish label. For example:
ExperimentFinish:
dim strBaseName as string
dim strEdatName as string
dim strTxtName as string
strTxtName = c.DataFile.Filename
strBaseName = FileParse$(strTxtName, 4) ' get name without extension
strEdatName = strBaseName & ".edat"
Name strTxtName As "renamed " & strTxtName
Name strEdatName As "also renamed " & strEdatName
The E-Basic help file contains some useful notes about this function. (Such as renaming to another folder on the same disk, or copying to another disk.) You should also use the FileExists function to take care of existing or duplicate filenames.
The risk of having your script code in the ebs-file is that you will loose the manually inserted script accidentally when you recompile the es-script. A (partly) workaround is to put the code in a subroutine in the user script section (Menu->View->Script->User tab) and only put a call to this script manually in the ebs-script. For example:
' subroutine in user script
Sub RenameOutputFiles()
dim strBaseName as string
dim strEdatName as string
dim strTxtName as string
strTxtName = ebContext.DataFile.Filename ' use global context
strBaseName = FileParse$(strTxtName, 4) ' get name without extension
strEdatName = strBaseName & ".edat"
Name strTxtName As "renamed " & strTxtName
Name strEdatName As "renamed " & strEdatName
End Sub
' manually in ebs
ExperimentFinish:
RenameOutputFiles
This way you will only have the risk of loosing the single ‘RenameOutputFiles’ subroutine call.
cheers
paul
Paul Groot
VU University Amsterdam, FPP-ITM
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 2/22/2008 3:53:38 PM
Posts: 3,
Visits: 12
|
|
this works great. thanks for the help.
mac373
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 10/29/2007 9:16:45 AM
Posts: 3,
Visits: 10
|
|
| I tried to use EKick to change the path for edat files but EKick wouldn't accept my .EBS2 file (it demands an .ebs, not .ebs2). Is there a new version of EKick that can be used for E-Prime 2.0? Thanks
|
|
|
|
|
Forum MVP
      
Group: Administrators
Last Login: Today @ 9:12:01 AM
Posts: 549,
Visits: 1,196
|
|
| If you are using E-Prime 2.0 Professional (build 2.0.1.99 or later), you can take advantage of the "startup info" facilities available. In this specific case, the local startup info file can set the DataFile.Filename.Override value which will adjust the name. Note that you do not add the edat or txt extension. All that you would need to do is rename the attached file to the root name of your experiment with a .startupInfo extension. And then edit the file with a text editor and change MyCustomData to whatever you felt the name should be. The attached file can be used with BasicRT. Open Basic RT and perform a Save As and select "ES2 Pro" in the save type (this is necessary to make the es2 a pro file). Save the file as BasicRTPro.es2. Then copy the attached file in the same folder as BasicRTPro.es2. More info about the external startup info properties is on the way. -Brandon
|
|
| |