Graphics

 View Only
  • 1.  Text contains

    Posted 08-20-2015 03:35
    Hi,

    I'm trying to figure out a way to run a script depending on whether a text item contains text from another text item. In this case, we have two teams, and our operator enters various comments for each team. So depending on which team is mentioned, (for example, if one team is called the Lions, when the operator enters "Lions are 4-0 this season") we want to toggle their logo. This is all done in one scene, and all the team info is fetched from an xml datalinq scource.

    So here's what I have so far: I have three text items: Home Team and Guest Team (which are hidden), and the main text item with this script:



    dim hometeam as xpTextObject

    dim guestteam as xpTextObject

    dim homelogo as xpBaseObject

    dim guestlogo as xpBaseObject

    scene.GetObjectByName("Home Team Text", hometeam)

    scene.GetObjectByName("Home Team Logo", homelogo)

    scene.GetObjectByName("Guest Team Text", guestteam)

    scene.GetObjectByName("Guest Team Logo", guestlogo)

    if text.contains(hometeam.text) then

    homelogo.visible = true

    guestlogo.visible = false

    else

    homelogo.visible = false

    guestlogo.visible = true

    end if



    But it doesn't seem to be working. I'm guessing it's something to do with the "if text.contains" command?

    Any insight is appreciated. Thanks!

    Chris


  • 2.  RE: Text contains

    Posted 08-20-2015 13:44
    text.contains is not a valid vbscript function.

    Try this instead:

    `if InStr(text, hometeam.text) then`

    InStr Function

    #XPression