Using Scrivener counter in Twitch Stream?

Hi,

In the future I want to start streaming on Twitch/YouTube. One of the things I’d like to show separately is a word/target counter. I know Scrivener has an excellent counter, but basically it will look like a screenshot in a stream as you can see in the screenshot… I was wondering if there’s a way to get the data of the project targets window (session goal and document goal) to load it into my stream.

Preferably I would have it better integrated into my stream, to make it look more like a subscriber/follower counter, like you can see in this screenshot from someone else’s stream:

Thanks for the help!

Yes indeed, it would be possible to extract this data at a fairly real-time rate. This is written to the MyProjectName.scriv/MyProjectName.scrivx XML file, in the main project folder itself. A passive script that watches the file system for modifications to that file, and scans it for particular element and attribute data, would be able to generate data for a live counter elsewhere.

Here’s an example of what you’re looking for in that file:

<ProjectTargets Notify="No">
    <DraftTarget>500</DraftTarget>
    <SessionTarget>200</SessionTarget>
    <PreviousSession Words="92" Characters="543" Date="2022-11-07 21:34:01 +0100"/>
</ProjectTargets>

I’ve simplified this a bit to remove some of the settings clutter, which you won’t need. You can get your overall goal from either the DraftTarget or SessionTarget text node, and your current session’s count (confusing element name notwithstanding) is the Words/Characters attributes of the PreviousSession element. You could also use the date stamp to verify that the update is meaningful, as the .scrivx file may update for other reasons periodically.

The main thing to be aware of is that this is tied to the auto-save interval. By default that triggers after two seconds of idleness, so it should remain fairly up to date. But if you’re the sort that goes for long periods of time without pausing, you might want alter your on-stream habits a bit, let it auto-save to let the counter script run and update the stream.

1 Like

Oh, thanks so much for your help! Now I’ll need to figure out how to implement this into OBS, but this is already extremely helpful!

Thanks so much!

gulp with tasks for watch, writing output to HTML document + livereload - OBS will happily capture a URL/browser…? Interesting project!

1 Like

You mean this gulp?: https://gulpjs.com/

And these for live reload and watch?

I hadn’t heard of the program, but it certainly sounds very interesting! Thanks for the help!

1 Like

Yep, Gulp is a simple task runner you can leave running in a terminal. It has its own watch as well for monitoring files for change. I use it all the time for my day job (web engineer), triggering file processing and upload and so forth on file save in my code editors (this is standard practice in web dev).

1 Like