Loading External Files Into A List - Proper Set-up
mcgree
mcgree at gmail.com
Wed Jan 13 22:02:09 UTC 2010
Thank you for the information. Unfortunately, I think that I have
done what is outlined here, but it doesn't seem to be working.
Obviously, I know that I am doing something wrong, I'm just not quite
sure what. Currently, I am just trying to get a practice program to
work rather than trying to tie together a full program and not be sure
where the errors are coming from. To give a bit more detail, I am
using the E-BasicExample file from the included tutorials. I have
added the following code to the script that is just before the list
named List1:
List1.LoadMethod = ebLoadMethodFile
List1.Filename = "MyTextFile.txt"
List1.Load
Additionally, I have created a .txt file that looks like the
following:
Weight Procedure Nested Stimulus CorrectAnswer
1 TrialProc Y 2
1 TrialProc X 1
1 TrialProc Y 2
1 TrialProc X 1
1 TrialProc Y 2
1 TrialProc X 1
(In the text file the information within each cell is actually located
under the proper title, but the formatting is not working correctly
here.) The only other information that I can think of that may be
helpful is that I have left the list blank with the exception of the
headers which are the same as the ones above.
I also tried two different ways to set up the rest of the code: one
where I left the procedure under the list (normal setup) and one where
I moved it to the unreferenced objects section. The first way
(basically just setting up the program normally) did not compile.
Instead, the "child item is a procedure" error popped up. The second
way (moving the procedure to the unreferenced objects section) allowed
the code to be compiled; however when I actually run the program E-
Prime crashes completely. Does anyone have any further thoughts on
why this may be or what I can do to fix this problem? Thanks!
On Jan 13, 7:35 am, liwenna <liwe... at gmail.com> wrote:
> Confusement I see!
>
> Something is terribly off in the part regarding "files/listsubject" &
> c.GetAttrib("subject") & ".txt" and/or the
> listsession" & c.GetAttrib("session") & ".txt" . The file that I took
> the code from actually uses an attribute called 'group' but as that is
> not a standard attribute in e-prime I thought that I would better
> replace it by session of subject and apparantly I didn't choose
> consequently ;)
>
> On Jan 13, 12:15 pm, liwenna <liwe... at gmail.com> wrote:
>
> > Hello mister mcgree!
>
> > Not quite sure about the child-thing but could something be amiss with
> > the formatting of your .txt file so that a procedure ends up in, for
> > instance, the nested column instead of the procedure column?
>
> > The thread you link too contains a LOT of information and features
> > while judging from your post I think you are only seeking for a way to
> > load a .txt file into a list.
>
> > Here is a bit more shorthand explanation of the 'basic way to load
> > a .txt file into a list'.
>
> > The .txt file should contain all the column headers of a 'normal
> > list' (e.g. weight nested procedure) and all your own variables (e.g.
> > stim) on the first line. Each 'collumn' must be separated by a tab.
> > The next lines of the .txt files hold the 'content' of each 'cell'
> > again divided by tabs.
>
> > Here is a simple .txt file (but google group doesn't handle tabs too
> > well... so it is a bit messy).
>
> > Weight Nested Procedure stim
> > 1 trialproc 2
> > 1 trialproc 3
> > 1 trialproc 1
> > 1 trialproc 4
>
> > Now in e-prime simply add an inline to the procedure that holds your
> > list and place it right before your list stating something like:
>
> > ---------------------------
>
> > Listname.LoadMethod = ebLoadMethodFile
>
> > Listname.Filename = "files/listsubject" & c.GetAttrib("subject") &
> > ".txt"
>
> > Listname.Load
>
> > -------------------
>
> > In the above example listname is the name of your list. Alo: the
> > "files/" part denotes e-prime to look into a folder called files
> > that's located within the folder that contains the e-studio file. I do
> > this to keep things somewhat tidy, if you want to keep your .txt files
> > in the same folder as your e-studio file is, remove the files/ part.
> > The listsession" & c.GetAttrib("session") & ".txt" is to show how to
> > select .txt files based on, for instance, subject number. For subject
> > 1 a file called listsubject1.txt will be opened, for subject 2
> > listsubject2.txt etc etc. A feature like that is usually needed in
> > cases where you need lists to be loaded from files.
>
> > For the die-hard coders among us you could/should insert a
> > listname.reset either somewhere AFTER the list has run or at the total
> > beginning of the above code, before it loads the .txt file into the
> > list.
>
> > Now: you still need a procedure for your list to run. I usually create
> > the procedure in the list 'the normal way' and leave it sitting there
> > but you could opt to leave your 'list to be filled' totally empty and
> > move the procedure to the 'unreferenced e-objects'. The moment
> > the .txt file is loaded into the list e-prime will start referring to
> > it.
>
> > And that... is pretty much all there is to it.
>
> > Unless you need more advanced options of course. In that case: let us
> > know what you need.
>
> > Good luck!
>
> > liw
>
> > On Jan 13, 1:22 am, mcgree <mcg... at gmail.com> wrote:
>
> > > Hello,
> > > I am trying to use the Factor.Load method to create a list from a
> > > text file that I specify. (See Post:http://groups.google.com/group/e-prime/browse_thread/thread/74f87efd6....)
> > > However, when I try to run the example from the help file I receive
> > > the following error when I try to compile the program: "child item is
> > > a procedure". I know a little about programming, but not much. Can
> > > anyone help me to fix this problem? Thank you very much in advance!
-------------- next part --------------
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.
More information about the Eprime
mailing list