Jump to content
Sign in to follow this  
Cable

Create a news ticker

Recommended Posts

I have a FileMaker solution that powers an internal "TV network". It runs over Intel Compute Sticks which have FileMaker installed on them and are connected to TVs mounted to the wall throughout the facility. A FileMaker script runs through various layouts and steps thru records on each layout. This lets us show a calendar, weather report (in a web viewer), company news, birthdays, customer feedback, employee recognition, and pictures.

I would like to add a news ticker to the solution, like you'd see on CNN scrolling across the bottom.

I have a table with the news stories in it. Since you can't run more than once script at the same time, I have a script set on the server to step through the news stories. For each story it uses "set field" to put the story in the field one letter at a time, then cuts off the left side when it gets too long. I then set the solution to open a floating document window at the bottom to display the layout that has the new field on it.

In theory, it should then appear that the story scrolls across the screen. It doesn't really work. It is jumpy and sometimes just doesn't show at all.

This is the gist of the script for the ticker:

Loop
Set Variable [$message; Value: (news story)]
Set Variable [$letter; Value: 1]

Loop
Set Field [Data::News;Right(Data::News;68) & Middle ($message; $letter; 1)]
Commit Records/Requests
Refresh Window []
Pause/Resume Script [Duration (seconds): .05]
Set variable [$letter; Value: $letter+1]
Exit Loop If [length($message) < $letter]
End Loop

Set Field [Data::News;Right(Data::News;68) & "     |     "]
Commit Records/Requests
Go to Records/Requests [(If ( Get(RecordNumber ) = Get(FoundCount);1;Get(RecordNumber ) + 1)]
End Loop

I've tried it with various pause durations, with/without the refresh, and with/sithout the first Commit. Nothing works the way I want.


Has anyone successfully implemented such a thing?

 

 

Share this post


Link to post
Share on other sites

Ok, that helped. I went with this code I found:

 

"data:text/html," & "

<!DOCTYPE html>
<html>
<head>
<title>News Ticker Demo</title>
<style>
  @keyframes ticker {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
  }
  .tcontainer{
    width: 100%;
    overflow: hidden;
  }
  .ticker-wrap {
    width: 100%;
    padding-left: 100%;
    background-color: #FFFFFF;
  }
  .ticker-move {
    display: inline-block;
    white-space: nowrap;
    padding-right: 100%;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
    animation-name: ticker;
    animation-duration: 30s;
  }
  .ticker-move:hover{
    animation-play-state: paused;
  }
  .ticker-item{
    display: inline-block;
    font-size: 3rem;
    padding: 0 2rem;
  }
</style>
</head>
<body>
  <div class=\"tcontainer\">
    <div class=\"ticker-wrap\">
      <div class=\"ticker-move\">
        <div class=\"ticker-item\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>
        <div class=\"ticker-item\">Aliquam consequat varius consequat.</div>
        <div class=\"ticker-item\">Fusce dapibus turpis vel nisi malesuada sollicitudin.</div>
        <div class=\"ticker-item\">Pellentesque auctor molestie orci ut blandit.</div>
      </div>
    </div>
  </div>
</body>
</html>


"

Now, what would be the best way of replacing the "latin" placeholder text with news? My problem is that there can be anywhere from 5-200 news stories to put into the ticker and that the number of stories can change during the day. At first I thought I'd just brute force it and loop thru all the news stories and put them into one text field to scroll but I'm hoping there's a more "mathy" way of doing it...

Share this post


Link to post
Share on other sites
2 hours ago, Cable said:

what would be the best way of replacing the "latin" placeholder text with news?

There are several options to consider. Much depends on how often you need to do this. If it's only now and then, then looping is not a bad choice, because it puts all the required logic in a script and avoids adding fields and relationships to the schema.

Otherwise you could add a calculation field to the News table that wraps each story in a div element, and get them using either the List() function over a relationship or a summary field defined as List of [the calculation field].

  • Like 1

Share this post


Link to post
Share on other sites
18 minutes ago, comment said:

There are several options to consider. Much depends on how often you need to do this. If it's only now and then, then looping is not a bad choice, because it puts all the required logic in a script and avoids adding fields and relationships to the schema.

Otherwise you could add a calculation field to the News table that wraps each story in a div element, and get them using either the List() function over a relationship or a summary field defined as List of [the calculation field].

I'm going to try that. Attempt 1 failed but I think I was just trying to cram too much into one (I was putting all the stories in one div instead of breaking them out). Thx.

Share this post


Link to post
Share on other sites

It worked! I also wrote a calc to tweak the speed based on the total length of news items so it will dynamically adjust as stories are added during the day. Appreciate the help.

Share this post


Link to post
Share on other sites

Hey Cable,

 

Do you think you can share your code here.  It will really help noobs like me.

 

Thanks a lot

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Similar Content

    • By St3v1e
      Hi,
      As a complete novice to FMP, I'm attempting my very first database. We rely on storing our contracts on Google & Dropbox. I've been trying to either embed the pdf's into a "tab", or (my preferred option) to have an "Add URL" button to link to the online pdf.
      I tried adding a field and copying and pasting the URL, but it's not clickable, and I'd need to add another field for each pdf/contract.
      Is there a better more efficient way to do this?
      Thanks
      Steve
    • By johnmarcel
      I have setup a layer with web viewer. I can maneuver within the website just fine but, I would like it if when the website loads it would send 4 carriage returns to get to a specific field within the website.
      If anyone has any ideas on how I can accomplish this it would be greatly appreciated.
       
      Thank You
      John
    • By john renfrew
      Have copied a shell script which works in other settings onto a new machine
      Changes paths - it zips a backup folder and does a ditto command to copy as a zip file to an external drive
      I worked out that I needed to change the sudoers file to allow no password access to the script. Running the shell script in terminal was requiring a password, now it doesn't 
      Added the fmserver user to that too.
       
      If I run the sh script from the admin console as fmserver it fails straight away, if I run it as the local user with its password it appears to run but in fact times out with a fail message, both of which are about invalid account name or password
       
      The script is working fine when run through terminal, doe not require password, just not when triggered from console.
      Does anyone have any light to shine on this???
    • By Otis
      Actually, I guess this could apply to macOS Mojave as well, but is there any way to get the Send Email script to work when creating a Runtime solution in macOS Catalina?
      I'm using FileMaker Pro Advanced 18 to create my runtime solution. I created a button on my main menu to send an email. When I click the button in High Sierra (and all previous macOS versions) it works. But in macOS Mojave and Catalina, nothing happens.
      I know that Apple placed security limits on applications, but there's no way to add my runtime to the list of allowable applications to execute a script. What is supposed to happen is that macOS is supposed to have a pop up that allows you to click to allow this application to run scripts and access mail.app. So this works in FileMaker Pro Advanced 18. However, when I covert my solution to a Runtime, it's no longer "FileMaker Pro Advanced" and instead is considered a Runtime app.
      In macOS Catalina, manually adding my runtime solution to this area didn't work: System Preferences > Security & Privacy > Privacy (tab) > Accessibility > (Allow these apps below to control your computer)
      Is there any way to allow a runtime to have a simple button to click Send Email in Catalina?
      I'm stumped.
    • By Faldo
      Good morning
      I was wondering if anyone had template for a basic home accounts sytem or the schema for the databases.
      Thanks again.
       
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.