Author Topic: Swapping Text Files with pauses  (Read 4973 times)

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Swapping Text Files with pauses
« on: April 26, 2018, 10:06:14 AM »
So folks I'm trying to do a little script to run all the time when streaming. Basically changing 1 text file but using data from other text files

Code: [Select]
Set Text [Bee Text Changer] to [C:\Users\crazybee\Documents\Stream Labels 2.0\most_recent_donator.txt] (Trim)
Write (overwrite), '{TXT:Bee Text Changer}' to file 'C:\Users\crazybee\Documents\EDDI2\Text Line Changer.txt'
Pause 3 seconds
Set Text [Bee Text Changer] to [C:\Users\crazybee\Documents\Stream Labels 2.0\most_recent_cheerer.txt] (Trim)
Write (overwrite), '{TXT:Bee Text Changer}' to file 'C:\Users\crazybee\Documents\EDDI2\Text Line Changer.txt'
Pause 3 seconds

I've come up with the above but if I change the pause to more than 3 seconds it comes up in the log window which I don't want (3 seconds or shorter nothing comes up in the log window) cause I'll have other scripts running that I want to keep tabs on. I just want it to run continuously but pause for 30 or 60 seconds. Only way I've found to not fill up the program log window is to make 10 3 second pauses, is that right?

Plus will this have performance of VA (lag, etc)

--
CMDR Bumble B ö7
ASUS P6TD Deluxe, Intel i7 960 @ 3.2GHz, 12Gb G.Skill, Windows 7 SP1 (64bit), ASUS Geforce GTX 970 Strix (4Gb), ThrustMaster T-Flight HOTAS X, Cosair Void RGB USB Gaming Headset, TrackIR, EDDI, Voice Attack, ED Engineer

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Swapping Text Files with pauses
« Reply #1 on: April 26, 2018, 10:39:41 AM »
If you don't want the log to show the command running you can use the "Ignore an Unrecognized Word or Phrase" action; Despite the description in the manual, the command will not be discarded and will execute normally(as far as I can see).

Performance-wise, unless you let the loop run free(without explicit pauses) it shouldn't have a noticeable performance impact(exceptions do apply, E.G. if you're writing a large continuous file to a physical hard disk you may see some delay from the head having to jump between it and the text file).

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Re: Swapping Text Files with pauses
« Reply #2 on: April 26, 2018, 11:13:36 AM »
I still see the "pause for 30 seconds" every 30 seconds in the log window. I have I used it right?

Code: [Select]
Do nothing (ignore command)
Pause 30 seconds
Set Text [Bee Text Changer] to [C:\Users\crazybee\Documents\Stream Labels 2.0\most_recent_donator.txt] (Trim)
Write (overwrite), '{TXT:Bee Text Changer}' to file 'C:\Users\crazybee\Documents\EDDI2\Text Line Changer.txt'
Pause 30 seconds
Set Text [Bee Text Changer] to [C:\Users\crazybee\Documents\Stream Labels 2.0\most_recent_cheerer.txt] (Trim)
Write (overwrite), '{TXT:Bee Text Changer}' to file 'C:\Users\crazybee\Documents\EDDI2\Text Line Changer.txt'
Pause 30 seconds
Set Text [Bee Text Changer] to [C:\Users\crazybee\Documents\Stream Labels 2.0\most_recent_follower.txt] (Trim)
Write (overwrite), '{TXT:Bee Text Changer}' to file 'C:\Users\crazybee\Documents\EDDI2\Text Line Changer.txt'
Pause 30 seconds
Set Text [Bee Text Changer] to [C:\Users\crazybee\Documents\Stream Labels 2.0\most_recent_subscriber.txt] (Trim)
Write (overwrite), '{TXT:Bee Text Changer}' to file 'C:\Users\crazybee\Documents\EDDI2\Text Line Changer.txt'
--
CMDR Bumble B ö7
ASUS P6TD Deluxe, Intel i7 960 @ 3.2GHz, 12Gb G.Skill, Windows 7 SP1 (64bit), ASUS Geforce GTX 970 Strix (4Gb), ThrustMaster T-Flight HOTAS X, Cosair Void RGB USB Gaming Headset, TrackIR, EDDI, Voice Attack, ED Engineer

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Swapping Text Files with pauses
« Reply #3 on: April 26, 2018, 11:56:11 AM »
You have, I haven't :-X

I got the command triggering mixed up with the pause message; That action will hide the former but not the latter.


However, it is possible to pause for any length of time without a log message by avoiding the native pause feature:
Code: [Select]
Set date [~~pause] value to the current date/time
Set date [~~pause] to [~~pause] plus [30] seconds
Start Loop While : [~~pause] Is Greater Than Current Date/Time
End Loop
Set Text [Bee Text Changer] to 'C:\Users\crazybee\Documents\Stream Labels 2.0\most_recent_donator.txt'
Write (overwrite), '{TXT:Bee Text Changer}' to file 'C:\Users\crazybee\Documents\EDDI2\Text Line Changer.txt'
The loop will run as long as the current time has not surpassed the initial time + 30 seconds in the future, and because it's empty it'll just hold up command execution until the loop ends.

It's a little more bulky, being 4 actions instead of 1, but it works fine.

Gangrel

  • Caffeine Fulled Mod
  • Global Moderator
  • Full Member
  • *****
  • Posts: 216
  • BORK FNORK BORD
Re: Swapping Text Files with pauses
« Reply #4 on: April 26, 2018, 12:26:53 PM »
Question: What is it that you are actually trying to achieve here concerning the text files? Is it so that you get EDDI to speak out the most recent donator/person to cheer?

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Re: Swapping Text Files with pauses
« Reply #5 on: May 07, 2018, 01:13:46 PM »
Question: What is it that you are actually trying to achieve here concerning the text files? Is it so that you get EDDI to speak out the most recent donator/person to cheer?

Not trying to get EDDI to speak it but VA to change 1 text file with the contents of others like a scroll as it where. So every 30 seconds or so the text changes from "Recent Follow" to "Recent Subscription" to "Recent Bits" etc

So in OBS it looks like 1 text line is changing to the different things listed above
--
CMDR Bumble B ö7
ASUS P6TD Deluxe, Intel i7 960 @ 3.2GHz, 12Gb G.Skill, Windows 7 SP1 (64bit), ASUS Geforce GTX 970 Strix (4Gb), ThrustMaster T-Flight HOTAS X, Cosair Void RGB USB Gaming Headset, TrackIR, EDDI, Voice Attack, ED Engineer

Gangrel

  • Caffeine Fulled Mod
  • Global Moderator
  • Full Member
  • *****
  • Posts: 216
  • BORK FNORK BORD
Re: Swapping Text Files with pauses
« Reply #6 on: May 07, 2018, 02:40:23 PM »
I just tried this in OBS:

you can actually set the image slide show to be text files

Also: You could look at something like impress.js or similar projects which would allow transitions.

SemlerPDX

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 291
  • Upstanding Lunatic
    • My AVCS Homepage
Re: Swapping Text Files with pauses
« Reply #7 on: May 07, 2018, 08:40:56 PM »
Here is a complete example you can import into your VA for closer examination (*plugins must be enabled, includes Swap Folder and Files examples packaged in VA/Apps Folder).  Note that this is a command set to repeat continuously, and would need to be manually terminated with the VA "Stop Commands" button.  It waits silently using Pfeil's example, and iterates through comparisons based on a variable that switches each time.

Download EnableSwappingTextFilesContent.vax and import to VA*
« Last Edit: May 08, 2018, 12:16:38 PM by SemlerPDX »

iceblast

  • Sr. Member
  • ****
  • Posts: 374
Re: Swapping Text Files with pauses
« Reply #8 on: May 07, 2018, 11:31:30 PM »
The Date/Time variable always seems confusing to me, and I never can get it to work quite right.

Here's a simple way to do a 30 sec delay. Just make a loop that repeats a select number of times, and just put a 1 second pause in it. 30 loops, would equal 30 seconds naturally. You could even use a variable for the number of loops if needed.

Code: [Select]
Start Loop : Repeat 30 Times
Pause 1 second
End Loop
« Last Edit: May 08, 2018, 01:14:22 AM by iceblast »

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Swapping Text Files with pauses
« Reply #9 on: May 08, 2018, 01:41:09 PM »
I'm wondering if I can just remove that log entry if it's being run asynchronously.  It's only there to let you know something is going on and the app is not just frozen up.  An asynchronous pause can just run on in the background while other commands are running and not give the impression that it's stuck.  Would that suffice?

Edit - This will be in the next release ;)
« Last Edit: May 08, 2018, 01:47:48 PM by Gary »

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Swapping Text Files with pauses
« Reply #10 on: May 08, 2018, 01:48:02 PM »
There is no reason to have a loop do that if it's just going to use the original Pause function (which displays "Pause X" in the VA log window) as you could very simply add a 30 second pause...

The constant loop that I proposed has merit if you need to interrupt it instantly, but in this situation iceblast's example is simpler and better suited to the task.

A pause under 3 seconds will not produce log output(as noted in the OP), so looping 30 1-second pauses, or 10 3-second pauses will work fine.

SemlerPDX

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 291
  • Upstanding Lunatic
    • My AVCS Homepage
Re: Swapping Text Files with pauses
« Reply #11 on: May 08, 2018, 01:55:53 PM »
(wipes egg from face)  :-X

I'm wondering if I can just remove that log entry if it's being run asynchronously.
...
Edit - This will be in the next release ;)

Thank you!

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Swapping Text Files with pauses
« Reply #12 on: May 08, 2018, 02:12:27 PM »
I'm usually on this kind of stuff sooner... I'm helping with medical stuffs the last few weeks, so, I'm somewhat out of the loop o_O  Sorry about that.

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Re: Swapping Text Files with pauses
« Reply #13 on: June 11, 2018, 08:41:38 AM »
Thanks folks, sorry its been awhile since replying and didnt see the other repies to this. I went with Pfeil's orignal script and make a few adjustments for my needs which seem to work.

Code: [Select]
Set date [~~pause] to [~~pause] plus [30] seconds
Start Loop While : [~~pause] Is Greater Than Current Date/Time
End Loop
Set Text [Bee Text Changer] to [C:\Documents\Stream Labels 2.0\donation_goal.txt] (Trim)
Begin Text Compare : [Bee Text Changer] Equals ''
    Jump to Marker: Skip Donation
Else
    Write (overwrite), ' {TXT:Bee Text Changer}' to file 'C:\Documents\EDDI2\Text Line Changer.txt'
End Condition

Set date [~~pause] value to the current date/time
Set date [~~pause] to [~~pause] plus [30] seconds
Start Loop While : [~~pause] Is Greater Than Current Date/Time
End Loop
Marker: Skip Donation
Set Text [Bee Text Changer] to [C:\Documents\Stream Labels 2.0\most_recent_donator.txt] (Trim)
Write (overwrite), ' {TXT:Bee Text Changer}' to file 'C:\Documents\EDDI2\Text Line Changer.txt'

Set date [~~pause] value to the current date/time
Set date [~~pause] to [~~pause] plus [30] seconds
Start Loop While : [~~pause] Is Greater Than Current Date/Time
End Loop
Set Text [Bee Text Changer] to [C:\Documents\Stream Labels 2.0\all_time_top_donator.txt] (Trim)
Write (overwrite), ' {TXT:Bee Text Changer}' to file 'C:\Documents\EDDI2\Text Line Changer.txt'

Set date [~~pause] value to the current date/time
I even made adjustments so if there was nothing in the text file it would skip to the next .txt file

I'm wondering if I can just remove that log entry if it's being run asynchronously.  It's only there to let you know something is going on and the app is not just frozen up.  An asynchronous pause can just run on in the background while other commands are running and not give the impression that it's stuck.  Would that suffice?

Edit - This will be in the next release ;)

I just read the last entry, could i now do it as I orignaly did it without the log window being filled up with the excuted command now?
--
CMDR Bumble B ö7
ASUS P6TD Deluxe, Intel i7 960 @ 3.2GHz, 12Gb G.Skill, Windows 7 SP1 (64bit), ASUS Geforce GTX 970 Strix (4Gb), ThrustMaster T-Flight HOTAS X, Cosair Void RGB USB Gaming Headset, TrackIR, EDDI, Voice Attack, ED Engineer