-
January 2nd, 2019, 06:58 PM
#1
POS Script - how to run it
Hey, so recently I came across this vid on youtube:
https://youtu.be/SjZg6AQBymY
and I'd like to make the same thing for myself. I have an Epson LQ-690 dot matrix printer.
Creator has posted his code (apparently Epson ESC/P script) which looks like this:
Code:
# LPnewswire draft, Albert Schaferle 2014-10-04
feedURI="http://feeds.reuters.com/Reuters/worldNews"
TMPt0=/tmp/LPnewswire.t0
TMPt1=/tmp/LPnewswire.t1
TMPdelta=/tmp/LPnewswire.delta
NLOG=~/LPnewswire/lpnlog
touch $TMPt0
curl --silent $feedURI | xml2 > $TMPt1
feedNAME=$(cat $TMPt1 | grep "^/rss/channel/title" | cut -d\= -f2)
echo -n "Started reading from "$feedNAME" on " | tee -a $NLOG
date -R | tee -a $NLOG
echo "Priting new headlines from "$feedNAME" - press CTRL + C to exit"
while true
do
curl --silent $feedURI | xml2 > $TMPt1
diff --ignore-blank-lines -b --ignore-case --old-line-format='' \
--new-line-format='%L' --unchanged-line-format='' \
$TMPt0 $TMPt1 > $TMPdelta
if [[ -s $TMPdelta ]] ; then # is delta non-empty?
NTIME=$(date -R)
NNEWL=$(cat $TMPdelta | wc -l)
echo "Found "$NNEWL" new lines @ "$NTIME | tee -a $NLOG
cat $TMPdelta | # bold title, normal description, rh-justified pubDate, all NLQ
grep "^/rss/channel/item/title\|^/rss/channel/item/description\|^/rss/channel/item/pubDate" |
sed '/title=/ s/$/ \\e\\x46/' |
sed 's,/rss/channel/item/title=,\\e\\x78\\x01\\e\\x61\\x00\\e\\x45\\e\\x47\n,' |
sed 's,/rss/channel/item/description=,,' |
sed 's,/rss/channel/item/pubDate=,\\e\\x46\\e\\x61\\x02,' |
cut -d\< -f1 |
sed '/^$/d' |
iconv -f UTF-8 -t IBM437 |
xargs --null echo -ne |
fold -sw 80 |
lpr -P lpt-raw
cp $TMPt1 $TMPt0 # I'm copying to cover up against curl giving blank output
else echo "."
fi ;
sleep 1m
done
echo "LPnewswire on "$feedNAME" exiting."
Since I am an absolute newbie, and I have literally no knowledge about POS or any simmilar language (besides it looks pretty simple and it looks like it's pretty easy to learn) I have a simple question.
How can you run this script? Do I have to compile it into an executable file? What software can be used to launch it?
Could anyone please help me figuring this out?
Thanks in advance!
-
January 3rd, 2019, 07:10 AM
#2
Re: POS Script - how to run it
-
January 3rd, 2019, 07:28 AM
#3
Re: POS Script - how to run it
Thanks for reply, I've figured it out.
I've put it into .sh file and ran it on Win10 with Debian subsystem. I have an issue I can't figure out any way. I keep getting printer error. Console returns this error:
Code:
lpr: lpt-raw: unknown printer
I've tried installing CUPS on the subsystem but then the error changes to
Code:
lpr: The printer or class does not exist.
Do you have any clue on how to make it work? The script itself runs and works (finds contents to print from Reuters news server) but gets stuck on this print command.
-
January 3rd, 2019, 08:51 AM
#4
Re: POS Script - how to run it
I've no idea, since I use real Linux distros, not some hackery to make Linux run in Windows.
Try googling "WSL configure printer".
-
January 3rd, 2019, 09:58 PM
#5
Re: POS Script - how to run it
LPT is most likely a printer port (i.e. a parallel port). Most modern hardware doesn't have a parallel port - it's been replaced by usb.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|