Passing/Evaluating Strings as Executable Code

David McFarlane mcfarla9 at msu.edu
Wed Jul 3 16:07:59 UTC 2013


Jake,

I am fairly certain that E-Basic/VBA does not have anything like an 
eval() function.

-----
David McFarlane
E-Prime training 
online:  http://psychology.msu.edu/Workshops_Courses/eprime.aspx
Twitter:  @EPrimeMaster (https://twitter.com/EPrimeMaster)


At 7/2/2013 01:21 PM Tuesday, Jake wrote:
>Oh, I see why that's not working now, the logic was overwriting the Attribute.
>
>Still, it would be good to know if you pass a string as an 
>expression.  I've search the documentation and some VB stuff online, 
>but I haven't seen an eval() like function. Has anyone else 
>used/seen something like that in E-Basic?
>
>Thanks,
>Jake
>
>
>On Tuesday, July 2, 2013 10:32:22 AM UTC-5, Jake wrote:
>  Dear Group,
>I'm trying to streamline some of my inline code in a Touch Screen 
>task. Is it possible to pass string values as execuatable pieces of 
>code in E-Basic? I can do this in MATLAB (I think) and R using and 
>eval() function, but is there an analogue in E-Basic?
>
>I've tried the following 'for' loop to assign an object border width 
>using the string returned from the HitTest function (Objects are 
>named "R0" through "R7"). I can compile the script fine, but it 
>won't actually change the attribute value for some reason. Perhaps I 
>just need a second set of eyes to point something out.  Any 
>suggestions would be welcomed! Thanks, Jake
>
>Set MouseResp = CMouseResponseData(Question.InputMasks.Responses(1))
>  Hit = theState.HitTest(MouseResp.CursorX, MouseResp.CursorY)
>  Dim i as Integer
>  Dim theBorder As String
>  For i = 0 To 7
>     theBorder = Hit & "BW"
>     If i = CInt(Mid(Hit,2,1)) Then
>       c.SetAttrib theBorder,"5"
>     Else
>       c.SetAttrib theBorder,"0"
>     End If
>  Next
>
>
>--
>*************************************************
>Jacob E. Anderson, MA
>Scientist @ The Zelazo Lab
>Institute of Child Development
>51 East River Rd.
>Minneapolis, MN 55455

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+unsubscribe at googlegroups.com.
To post to this group, send email to e-prime at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/e-prime/51d44c69.472c320a.5826.6445SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
For more options, visit https://groups.google.com/groups/opt_out.



More information about the Eprime mailing list