CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 5 of 5

Thread: POS Script - how to run it

Hybrid View

  1. #1
    Join Date
    Jan 2019

    POS Script - how to run it

    Hey, so recently I came across this vid on youtube:

    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:

    # LPnewswire draft, Albert Schaferle 2014-10-04
    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
        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
    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!

  2. #2
    Join Date
    Nov 2018

    Re: POS Script - how to run it

  3. #3
    Join Date
    Jan 2019

    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:
    lpr: lpt-raw: unknown printer
    I've tried installing CUPS on the subsystem but then the error changes to
    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.

  4. #4
    Join Date
    Nov 2018

    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".

  5. #5
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004

    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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)