Passing/Evaluating Strings as Executable Code

Paul Groot pfc.groot at gmail.com
Wed Jul 3 20:32:21 UTC 2013


Hi Jake,

I think you are looking for a solution that is more complex than actually
required. Instead of changing an object property indirectly by changing an
attribute value, why not changing the object property directly?

This is a piece of code that I used in my VAS script to highlight a
selected button:

        Set hitObject = CSlideText(ACK_SlideState.Objects(strHit))
        hitObject.BackColor = CColor("silver")
        hitObject.Draw
        etc...


Best
Paul



On 3 July 2013 18:07, David McFarlane <mcfarla9 at msu.edu> wrote:

> 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<http://psychology.msu.edu/Workshops_Courses/eprime.aspx>
> Twitter:  @EPrimeMaster (https://twitter.com/**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@**googlegroups.com<e-prime%2Bunsubscribe 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<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<https://groups.google.com/groups/opt_out>
> .
>
>
>

-- 
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/CAKAdR-sZwibQVDknGA1OvQ15vxAKzk9ZjDCsw%3DALp1usWVos0A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20130703/19e75ee7/attachment.htm>


More information about the Eprime mailing list