Graphics

 View Only
  • 1.  Copy line from text object to another text object

    Posted 06-15-2022 17:39
    Hello!

    In my scene i have one text object, named "team". I want to identify each line from this text object and copy (each line) in separate text objects. To exemplify this, if in my "team" text object i enter this: 
    Player1
    Player2
    Player3
    what i want to achieve is to copy line 1 from "team" in another text object named "line1", therefore in my "line1" to have now as input text "Player1". Same for other lines, "line2" to have "Player2" etc...
    I don't see how to make this possible via visual logic, and i don't have any clue how to script this. Any help is welcome!
    We run on Xpression 5.9 SCE.

    ------------------------------
    Gheorghe Radu
    Graphics Team
    Clever Media Network
    ------------------------------


  • 2.  RE: Copy line from text object to another text object

    Posted 06-23-2022 14:45
    You want to write something that at its most simple would be,

    dim ln1, ply1 as xptextobject 

    scene.getobjectbyname("Line1", ln1)
    scene.getobjectbyname("Player1", ply1)

    ply1.text = ln1.text 


    however this quite slow so a loop would work well onOnline;

    dim line, player as xpTextObject

    dim i as integer 

    for i = 1 to 11
    self.getobjectbyname("Line" & i, line)
    self.getobjectbyname("Player" & i, player)

    player.text = line.text 
    next 


    it's best to put the same script in OnPreviewRender as well so you see it preview.

    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 3.  RE: Copy line from text object to another text object

    Posted 07-06-2022 05:30
    Hello and thank you for the input, much appreciated! However this is not what i want to do. What i try to achieve is to read lines from one text object (team), and after that, put each line identifiyed from "team" text object in separate text objects (player1, player2, player3... and so on). Basically, i want ease the work of graphic operators, so they input this text in one single place (team text object):
    Player1 Name
    Player2 Name
    Player3 Name
    .
    .
    .
    .
    This from above is one single text object. Via scripting i want to identify each line from it and copy each of them into the appropriate text objects (player1, player2, etc...).
    I still work on this, not solved yet.
    Thanks again!

    ------------------------------
    Gheorghe Radu
    Graphics Team
    Clever Media Network
    ------------------------------



  • 4.  RE: Copy line from text object to another text object

    Posted 07-06-2022 12:39
    I'm still trying to decipher your goal.
    If I'm guessing correctly, you want to assign a "team" and then use that identifier to pull player names associated with that team.

    Since I'm no scripting expert, and you don't want your operator to have to retype everything, I'd suggest using a spreadsheet and datalinq, especially if you're getting the player roster from a website or third party - should be fairly straightforward to copy/paste.

    Hope this makes sense.
    -Michelle​

    ------------------------------
    Michelle Owczarski
    ------------------------------



  • 5.  RE: Copy line from text object to another text object

    Posted 07-06-2022 15:48
      |   view attached
    Probably something like this placed on set text will do what you want. 

    dim t1, t2, t3 as xpTextObject

    scene.GetObjectByName("Target1", t1)
    scene.GetObjectByName("Target2", t2)
    scene.GetObjectByName("Target3", t3)

    t1.Text = split(text, ",")(0)
    t2.Text = split(text, ",")(1)
    t3.Text = split(text, ",")(2)





    I attached an .xpf as well.
    **Edit: (you don't need the integer value I placed in there, that was some other thinking I went down first but it has given me an idea).

    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------

    Attachment(s)

    xpf
    SplitText.xpf   16 KB 1 version


  • 6.  RE: Copy line from text object to another text object

    Posted 07-06-2022 15:56
      |   view attached
    I turned it into a loop instead which makes it much tidier. 



    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------

    Attachment(s)

    xpf
    SplitTextLoop.xpf   25 KB 1 version


  • 7.  RE: Copy line from text object to another text object

    Posted 07-07-2022 08:57
    Fantastic! This works perfectly for what i needed with the scene.
    Thank you Simon, you made my day!
    Gotta learn scripting, so much that can be done that way!

    ------------------------------
    Gheorghe Radu
    Graphics Team
    Clever Media Network
    ------------------------------



  • 8.  RE: Copy line from text object to another text object

    Posted 07-07-2022 08:59
    No problem, I am happy to help :)

    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------