Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Text from external file .txt #863

Open
marteloudini opened this issue Dec 9, 2024 · 4 comments
Open

Text from external file .txt #863

marteloudini opened this issue Dec 9, 2024 · 4 comments

Comments

@marteloudini
Copy link

can you add simple mode, to create typewriter screen and display all text from external .txt

Thanks.

@normanr
Copy link

normanr commented Jan 6, 2025

You probably want to use one of the various tools like script or ttyrec that can record and replay terminal information.

@marteloudini
Copy link
Author

You probably want to use one of the various tools like script or ttyrec that can record and replay terminal information.

no, i want use cool-retro-term and simples externals files .txt into directory example : chap01/text001 ; chap01/text002 ; chap02/text001 ; chap02/text002 ; chap02/text003 etc..
and all files view into cool-retro-term easely.

@normanr
Copy link

normanr commented Feb 1, 2025

Like using cat chap01/text001 (or maybe less)? Or maybe one of the many suggestions at something like https://superuser.com/questions/526242/cat-file-to-terminal-at-particular-speed-of-lines-per-second

@marteloudini
Copy link
Author

marteloudini commented Feb 1, 2025

Like using cat chap01/text001 (or maybe less)? Or maybe one of the many suggestions at something like https://superuser.com/questions/526242/cat-file-to-terminal-at-particular-speed-of-lines-per-second

interresting, thanks i look that.

i run cool-retro-term, after i call un perl script catLps.pl

`#!/usr/bin/perl -w

use strict;
use Time::HiRes qw|time|;

my $start=time;
my $lps=300;

$lps=shift @argv if @argv && $ARGV[0]=~/^(\d+)$/;
my $sleepPerLine=1/$lps;

print &&
select undef,undef,undef,($start + $sleepPerLine*$. - Time::HiRes::time)
while <>`

Usage:
catLps.pl [lps] [file] [file]...

First argument lps is optional line per seconds numeric argument (default: 300)
Note: if filename is only numeric, you may have to specifiy them with path: ./3.
Like cat this could pass files given as argument and/or standard input

So we could:
TIMEFORMAT='%R'
time seq 1 100 | ./catLps.pl 100 >/dev/null
1.040

time seq 1 10000 | ./catLps.pl 10000 >/dev/null
1.042

For fun:
export TIMEFORMAT='%R' ;clear ;time seq 1 $((LINES-2)) | ./catLps.pl $((LINES-2))

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants