logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
ArunLongjam  
#1 Posted : Sunday, April 16, 2023 4:09:20 PM(UTC)
ArunLongjam

Rank: Member

Groups: Registered
Joined: 8/22/2020(UTC)
Posts: 12
India
Location: Manipur

Hi everyone! I want my ticker move to the next row of data source automatically after completing it's width. Ticker font size is 36(Arial), the width of the ticker window is 339/895 and the speed of the ticker is 4. Each row in data source have different text length. Thanks.
doggy  
#2 Posted : Sunday, April 16, 2023 10:32:54 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,216
Belgium
Location: Belgium

Thanks: 291 times
Was thanked: 955 time(s) in 790 post(s)
Originally Posted by: ArunLongjam Go to Quoted Post
Hi everyone! I want my ticker move to the next row of data source automatically after completing it's width. Ticker font size is 36(Arial), the width of the ticker window is 339/895 and the speed of the ticker is 4. Each row in data source have different text length. Thanks.



Using a script"

Get the data from the title (headline and ticker text) currently in the title that was fed by the datasource

if the headline text changes calculate the duration needed for the new ticker text to pass fully by using the speed of the ticker, framerate of the production,the width of the ticker , and the average characterwidth of the font used in the ticker and pause (sleep) the script running for that duration.
When that time has elapsed select the next data source row
Rinse and repeat.

optimize a bit by checking for end of datasource etc
ArunLongjam  
#3 Posted : Monday, April 17, 2023 4:34:07 AM(UTC)
ArunLongjam

Rank: Member

Groups: Registered
Joined: 8/22/2020(UTC)
Posts: 12
India
Location: Manipur

Thank you @doggy. I’m totally new in scripting and learning it. Can you plz write the script and share if there is possible tutorial or link? Thanks.
doggy  
#4 Posted : Wednesday, April 19, 2023 9:35:25 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,216
Belgium
Location: Belgium

Thanks: 291 times
Was thanked: 955 time(s) in 790 post(s)
ArunLongjam  
#5 Posted : Sunday, April 23, 2023 1:38:53 PM(UTC)
ArunLongjam

Rank: Member

Groups: Registered
Joined: 8/22/2020(UTC)
Posts: 12
India
Location: Manipur

Originally Posted by: doggy Go to Quoted Post
https://youtu.be/YPetIze1Os8


Thanks doggy, It's what I've been looking for a long time.. Can you share the code & files? It will help me most. Thanks.
nikosman88  
#6 Posted : Thursday, April 27, 2023 5:02:53 AM(UTC)
nikosman88

Rank: Advanced Member

Groups: Registered
Joined: 12/24/2021(UTC)
Posts: 508
Greece
Location: athens

Thanks: 123 times
Was thanked: 71 time(s) in 67 post(s)
Originally Posted by: ArunLongjam Go to Quoted Post
Originally Posted by: doggy Go to Quoted Post
https://youtu.be/YPetIze1Os8


Thanks doggy, It's what I've been looking for a long time.. Can you share the code & files? It will help me most. Thanks.

Hello doggy motivated me to try to do something that will do this thing. As i dont how to code in VB.NET language or any other language i thought that i can ask AI and improvise on how to do this procedure. The difficult thing here (at least for me) is that in vmix xml api it doesnt say the speed of the ticker so we can use it as reference. So i made (to be exactly i said AI to do for me) a python script. Here this is the code. If you want to try it, you have first to install python in your pc. Here https://forums.vmix.com/...e-way-for-vmix-scripting is some instructions on how to do it
Code:

import requests
import time
import xml.etree.ElementTree as ET

def request_ticker_title():
    return input("Enter please your ticker name: ")

def get_ticker_info(title):
    response = requests.get("http://127.0.0.1:8088/api")
    root = ET.fromstring(response.content)

    for input_element in root.findall("inputs/input"):
        input_title = input_element.get("title")
        if input_title.lower() == title.lower():
            text_element = input_element.find("text")
            state = input_element.get("state")
            return text_element.text, state == "Running"
    
    return "", False

def send_data_source_next_row():
    response = requests.get("http://127.0.0.1:8088/api/?Function=DataSourceNextRow&Value=Excel/CSV,Sheet1")
    print("Updating data source:", response)

def send_data_source_select_row(row_number):
    response = requests.get(f"http://127.0.0.1:8088/api/?Function=DataSourceSelectRow&Value=Excel/CSV,Sheet1,{row_number}")
    print("Selecting Data source row:", response)

def calculate_wait_time(ticker_text, base_time, base_text_length, time_per_char):
    char_count = len(ticker_text)
    return base_time + (char_count - base_text_length) * time_per_char

def request_last_row_text():
    return input("Enter the last text line of your ticker: ")

def main():
    ticker_title = request_ticker_title()
    last_row_text = request_last_row_text()
    ticker_was_running = False
    prev_ticker_text = ""

    base_time = 9
    base_text_length = len("BYE")
    time_per_char = (11.5 - 9) / (len("HOW ARE YOU? LET ME SEE THE RESULT") - len("BYE"))

    while True:
        ticker_text, ticker_running = get_ticker_info(ticker_title)
        print(f"Text of the ticker: {ticker_text}, State of the ticker: {ticker_running}")

        if ticker_running:
            if not ticker_was_running or ticker_text != prev_ticker_text:
                wait_time = calculate_wait_time(ticker_text, base_time, base_text_length, time_per_char)
                print(f"Wait for {wait_time} seconds")
                time.sleep(wait_time)
                send_data_source_next_row()
                time.sleep(1)

                if last_row_text and ticker_text == last_row_text:
                    send_data_source_select_row(0)
                    time.sleep(1)

        ticker_was_running = ticker_running
        prev_ticker_text = ticker_text
        time.sleep(1)

if __name__ == "__main__":
    main()

How this code work? When you make your .py file you have to do some modifications for your needs. At first you need in this line response = requests.get("http://127.0.0.1:8088/api/?Function=DataSourceNextRow&Value=Excel/CSV,Sheet1") and this line response = requests.get(f"http://127.0.0.1:8088/api/?Function=DataSourceSelectRow&Value=Excel/CSV,Sheet1,{row_number}") to change Sheet1 to the name of your excel/csv file and press save. Τhen in vmix rename your ticker in something you want. For example Ticker1 and run your .py script. It will ask for you to enter the name of your ticker. For example Ticker1 and press enter. Now script will ask you to enter the last datasource line of your ticker. This is optional and you can press enter and continue
The reason I did it this way is because I couldn't find in the XML API of vMix when the last line of the datasource is, so that the script can go back to the first line and continue running. If we leave the field empty here and press enter, once it reaches the last line of the datasource, it will stay there and repeat the last line in the ticker. If we put the text we have on the last line in the field, then once it passes, the script will go back and run the ticker again from the first line of the datasource. I've done it for vMix production 1080 50i. It's not perfect, but I think it does the job.After all, AI can't replace a person who knows programming well.
Now, depending on the length of the text you will be running, you can adjust the numbers in the function time_per_char = (11.5 - 9) / (len("HOW ARE YOU? LET ME SEE THE RESULT") - len("BYE")) or change the words and text I have put to compare. You can try it, do tests if you want. I know it's not the most perfect thing that could be done, but okay, since I like to search and learn (even if AI has to write the code for me, it's not always easy to explain to a machine what code you want it to write) it gave me the opportunity to try what will come out.
doggy  
#7 Posted : Thursday, April 27, 2023 5:57:35 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,216
Belgium
Location: Belgium

Thanks: 291 times
Was thanked: 955 time(s) in 790 post(s)
Originally Posted by: nikosman88 Go to Quoted Post
it's not always easy to explain to a machine what code you want it to write


Not only to a machine ;-) Many are not even capable of explaining a scripting goal to a human
WHy its helpful to learn a bit of a language to get a better feel for logic, also be able to see how more simple it can be than what AI gives you.

Before vMix allowed internal scripting it made sense to use externally coded ones. Now not so much epecially for simple scripts within a single sub or function
nikosman88  
#8 Posted : Friday, April 28, 2023 1:00:12 AM(UTC)
nikosman88

Rank: Advanced Member

Groups: Registered
Joined: 12/24/2021(UTC)
Posts: 508
Greece
Location: athens

Thanks: 123 times
Was thanked: 71 time(s) in 67 post(s)
Originally Posted by: doggy Go to Quoted Post
Originally Posted by: nikosman88 Go to Quoted Post
it's not always easy to explain to a machine what code you want it to write


Not only to a machine ;-) Many are not even capable of explaining a scripting goal to a human
WHy its helpful to learn a bit of a language to get a better feel for logic, also be able to see how more simple it can be than what AI gives you.

Before vMix allowed internal scripting it made sense to use externally coded ones. Now not so much epecially for simple scripts within a single sub or function


You're right. By the way the logic you see in this script is 100% mine because i couldnt find any other way to implement it. Of course there maybe something that i miss and needed to do it this way
Papo  
#9 Posted : Friday, April 28, 2023 4:55:32 AM(UTC)
Papo

Rank: Advanced Member

Groups: Registered
Joined: 6/16/2020(UTC)
Posts: 77
Peru

Thanks: 8 times
Was thanked: 2 time(s) in 2 post(s)
so sorry for this, you could at least try with a xaml
I tried this in a basic xaml ticker where I removed the automatic repetition, basically it is a ticker that has no repetition

create a simple data source in my case an excel csv
autonext disabled 1 second update and loop enabled

in the ticker triggers put 3 of them all with the OnCompletion event
the first put datasourceautonextON
the second put datasourceautonextOff but we give it a delay of 1000, so it takes time to go to the next row
the third play this in the ticker input.

Translated from Spanish to English by Google
doggy  
#10 Posted : Friday, April 28, 2023 6:08:22 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,216
Belgium
Location: Belgium

Thanks: 291 times
Was thanked: 955 time(s) in 790 post(s)
Originally Posted by: Papo Go to Quoted Post
so sorry for this, you could at least try with a xaml
I tried this in a basic xaml ticker where I removed the automatic repetition, basically it is a ticker that has no repetition

create a simple data source in my case an excel csv
autonext disabled 1 second update and loop enabled

in the ticker triggers put 3 of them all with the OnCompletion event
the first put datasourceautonextON
the second put datasourceautonextOff but we give it a delay of 1000, so it takes time to go to the next row
the third play this in the ticker input.

Translated from Spanish to English by Google


With due respect , did you actualy run this process ?
Oncompletion triggers to not respond to a ticker scroll situation!
Second, in no way would this take into account the length of the current text length (show next when complete text has passed by) as asked by OP and shown in the video above done with a script as described in post #2
Papo  
#11 Posted : Saturday, April 29, 2023 1:02:37 AM(UTC)
Papo

Rank: Advanced Member

Groups: Registered
Joined: 6/16/2020(UTC)
Posts: 77
Peru

Thanks: 8 times
Was thanked: 2 time(s) in 2 post(s)
Greetings, yes I have tried it, it goes through all the data sources, the text finishes being displayed and begins with the next row, this ends and continues with the next row and so on, perhaps it has not happened because it is not in the program or as an overlay so that the oncompletion option is active. greetings
PS: there is a video in post4 that does the same as the procedure I suggested, or maybe it's wrong, ... that maybe the user is asked not to show that white space while the text is finished showing, if so my given example is wrong, sorry if this is so
translated from spanish to english by google
doggy  
#12 Posted : Saturday, April 29, 2023 2:43:08 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,216
Belgium
Location: Belgium

Thanks: 291 times
Was thanked: 955 time(s) in 790 post(s)
Originally Posted by: Papo Go to Quoted Post

PS: there is a video in post4 that does the same as the procedure I suggested, or maybe it's wrong, ... that maybe the user is asked not to show that white space while the text is finished showing, if so my given example is wrong, sorry if this is so


i know i created and posted the video based on a script logic explained before (post #2). It lets the text completely finish first before the next one appear taking into account the variable length of each row of text. in order to achieve that one has to determin the length of the text and calculate the time needed to do so (Not a fixed pause time) as per question by the original poster
nikosman88  
#13 Posted : Saturday, April 29, 2023 2:45:30 AM(UTC)
nikosman88

Rank: Advanced Member

Groups: Registered
Joined: 12/24/2021(UTC)
Posts: 508
Greece
Location: athens

Thanks: 123 times
Was thanked: 71 time(s) in 67 post(s)
Originally Posted by: Papo Go to Quoted Post
Greetings, yes I have tried it, it goes through all the data sources, the text finishes being displayed and begins with the next row, this ends and continues with the next row and so on, perhaps it has not happened because it is not in the program or as an overlay so that the oncompletion option is active. greetings
PS: there is a video in post4 that does the same as the procedure I suggested, or maybe it's wrong, ... that maybe the user is asked not to show that white space while the text is finished showing, if so my given example is wrong, sorry if this is so
translated from spanish to english by google

Hello. it does not work. What am i doing wrong?
ticker.png (20kb) downloaded 0 time(s).
doggy  
#14 Posted : Saturday, April 29, 2023 2:57:46 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,216
Belgium
Location: Belgium

Thanks: 291 times
Was thanked: 955 time(s) in 790 post(s)
Originally Posted by: nikosman88 Go to Quoted Post
Originally Posted by: Papo Go to Quoted Post
Greetings, yes I have tried it, it goes through all the data sources, the text finishes being displayed and begins with the next row, this ends and continues with the next row and so on, perhaps it has not happened because it is not in the program or as an overlay so that the oncompletion option is active. greetings
PS: there is a video in post4 that does the same as the procedure I suggested, or maybe it's wrong, ... that maybe the user is asked not to show that white space while the text is finished showing, if so my given example is wrong, sorry if this is so
translated from spanish to english by google

Hello. it does not work. What am i doing wrong?


because oncompletion does not respond as such to a xaml title or a gt title ( and what if there are multiple tickers in one title ? ) dispite what Papo claims
hence a script is used (result in video posted ) to calculate the length of the text etc etc
https://forums.vmix.com/...Not-Triggering#post70088
Users browsing this topic
Guest (2)
Similar Topics
Tickers and Titles Disappeard on SW update (General Discussion)
by sjcaldwell 11/8/2024 5:48:16 AM(UTC)
excel data source in ticker (General Discussion)
by kalpesh175 3/18/2024 7:32:24 PM(UTC)
GT Ticker problem with Farsi language (GT)
by persian398 2/17/2024 7:03:55 AM(UTC)
Ticker is fully exhausted before looping (GT)
by jaylaw64 12/5/2023 10:15:33 PM(UTC)
MalFuncion Ticker in vmix (GT)
by najafysmm 12/4/2023 3:19:25 PM(UTC)
Ticker speed and loop (GT)
by jas105 10/31/2023 2:30:30 PM(UTC)
Tickers | Data Sources Manager | Multiple Titles (General Discussion)
by cuyahogacuse 7/26/2023 5:07:55 AM(UTC)
Ticker with graphics/logos (Feature Requests)
by FKmedia 3/26/2023 4:09:57 AM(UTC)
Ticker bug with adjustable background (GT)
by abcwille 3/10/2023 7:28:13 PM(UTC)
How To Create A Ticker With Scrolling Images/Text (GT)
by Widget 3/4/2023 8:10:56 AM(UTC)
Continuous Scroll On Ticker (GT)
by Widget 2/15/2023 4:54:21 AM(UTC)
Move to next line in data source after ticker end (GT)
by Scar7752 1/9/2023 8:11:47 PM(UTC)
create RTL Ticker (Feature Requests)
by Winops 11/16/2022 9:50:52 PM(UTC)
Ticker Bug with Big Font Sizes (GT)
by Streamverse.tv 10/13/2022 12:00:59 AM(UTC)
issue with Ticker 10 scrollin'.gtzip (GT)
by HWL1223 10/11/2022 12:45:22 PM(UTC)
Ticker / Crawler - add image instead of text (General Discussion)
by gre2gor 9/2/2022 9:10:45 PM(UTC)
GT ticker automation (GT)
by ArunLongjam 8/15/2022 9:05:51 PM(UTC)
Ticker object settings reset after save/close (General Discussion)
by MSFTGuruGuy 7/21/2022 4:05:22 AM(UTC)
TICKER DIFFERENT MOTION (GT)
by GHz 7/6/2022 3:11:21 AM(UTC)
Social Ticker 1 (GT)
by Simsyuk 6/15/2022 5:56:23 PM(UTC)
Ticker with Google Sheet data source only displaying one column (General Discussion)
by Tone13 4/15/2022 10:46:18 AM(UTC)
Does GT Ticker impose a GPU upgrade? (GT)
by kenmcl0126 12/6/2021 4:42:10 AM(UTC)
Participants list as data source for Ticker (General Discussion)
by Grimm 11/19/2021 8:12:47 PM(UTC)
Logo separator in ticker (Feature Requests)
by DYJVMIX 8/6/2021 5:31:06 PM(UTC)
Multi line ticker (General Discussion)
by Joeboe 7/23/2021 6:08:55 AM(UTC)
Ticker Titles (General Discussion)
by Joeboe 6/19/2021 2:54:41 PM(UTC)
how to remove ticker (General Discussion)
by steve907 3/19/2021 4:43:59 AM(UTC)
vMix Social & Social Ticker Post Spacing (Feature Requests)
by TBacker 3/10/2021 12:48:10 PM(UTC)
restart ticker not working with sheets data source (General Discussion)
by peterg60 2/16/2021 8:46:22 AM(UTC)
Data Sources For Tickers (General Discussion)
by PinMason 2/6/2021 3:25:17 AM(UTC)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.