Graphics

 View Only
  • 1.  Need help with scripting basics

    Posted 11-06-2018 20:50
    I am new to Xpression and need some guidance. I know vbs very well and am proficient at it on the other 2 graphics machines. Xpression seems to be much stricter with the language. All I am trying to do for right now is change text in a text field using a hot key script. I have cobbled this together from examples found in this forum:

    Dim text1 As xpTextObject
    Dim scene As xpScene

    Engine.GetSceneByName("Scene1", scene, False)
    scene.GetObjectByName("Text1", text1)
    text1.text = "Some New Text"

    If I change the False to True nothing at all happens. With it set to False I see the text change in Layout mode but nothing happens in Sequence mode. This does not seem like a hard thing to accomplish. What am I missing?


  • 2.  RE: Need help with scripting basics

    Posted 11-06-2018 22:36
    Items in the Sequencer are Take Items, not Scenes. Take Items are copies of scenes, so your script is only changing the original scene and not the Take Item (Scene Copy).

    You need to either grab the take item in the Sequencer and change it's published objects:

    dim takeitem as xpTakeItem
    Engine.Sequencer.GetTakeItemByID(1234, takeitem)
    takeitem.GetPublishedObjectByName

    Or grab the take item (or scene) on the output and change it's objects or published objects:

    dim output as xpOutputFramebuffer
    Engine.GetOutputFramebuffer(0, output)
    Output.GetSceneOnLayer or Output.GetTakeItemOnLayer


    Obviously these are not full examples, just pointing you in the right direction. Let us know if you need specific examples.
    #XPression


  • 3.  RE: Need help with scripting basics

    Posted 11-06-2018 22:41
    Reference for scripting is found in Windows Start Menu > All Programs > XPression > Help > XPression SDK Help
    #XPression


  • 4.  RE: Need help with scripting basics

    Posted 11-06-2018 22:56
    Thank you for the help
    #XPression


  • 5.  RE: Need help with scripting basics

    Posted 11-07-2018 05:49

    Here's two scripts that do this in different ways with different results:

    dim output as xpOutputFramebuffer
    dim scene as xpScene
    dim Text1 as xpTextObject

    'get scene on framebuffer 1 (index 0), layer 0
    Engine.GetOutputFrameBuffer(0, output)
    output.GetSceneOnLayer(0, scene)

    'get the text object "Text1"�
    scene.GetObjectByName("Text1", Text1)

    Text1.text = "Garner"

    Engine.DebugMessage("Text was changed", 1)



    This would change the text object live on the output but would not write the change back to the take item in the Sequencer.

    Here's the script if you wanted to write the text to the take item (but this wouldn't change on air) "“ you could combine them (with small tweaks) if you wanted to do both.


    dim output as xpOutputFramebuffer
    dim take as xpTakeItem
    dim Text1 as xpPublishedObject

    'get the take item on framebuffer 1 (index 0), layer 0
    Engine.GetOutputFrameBuffer(0, output)
    output.GetTakeItemOnLayer(0, take)

    'get the published object called "Text1" from the take item
    take.GetPublishedObjectByName("Text1", Text1)

    Text1.SetPropertyString(0, "Some Text")

    Engine.DebugMessage("Text was changed", 1)

    #XPression


  • 6.  RE: Need help with scripting basics

    Posted 11-07-2018 05:50
    There may very well be a better way of doing this, but this would be my approach.
    #XPression