!Teletext Script
Annotated version of 'bbcnews'

 

This script is pretty much self-documenting...
Basically, the only point to note is that it was written in January 2002. If the BBC have altered the layout of their news pages, you might need to alter this script.

; Script to fetch news articles on BBC ceefax
;
; Timed at 4 minutes, 16 seconds.
; Most of this wating for page fetches.

¤script "bbcnews"

; Select channel
channel(1)

; check we are receiving
getframe(100)
set A to status(pagefound)
if (A ! 1) error("Timed out trying to fetch page - is antenna connected?")

; start at 104, finish at 124
set A to 104
set E to 124

.fetchloop
  getframe(A)
Unlike a number of other scripts, we process what we receive, as we receive it.
  ; now remove the top/bottom
  set B to 1
  ; Choose a frame
  selectframe(A)
We remove lines 1 to 5 (inclusive), as these are the mosaic-character titles that'll just look weird in ASCII form.
  ; Remove the top of the frame
  set C to 1
  .omittop
    omitline(C)
    C++
    if(C [ 5) go("omittop")
And we do the same with the bottom of the frame(s), lines 22 to 25 inclusive.
  ; Remove the end of the frame
  set C to 22
  .omitend
    omitline(C)
    C++
    if(C [ 25) go("omitend")

  ; Finished updating, store the frame
  storeframe()

  ; Increment the frame, see if now next page
  A++
  if(A [ E) go("fetchloop")

; Open file, and copy frames to it as ASCII
filewrite("<Teletext$Temp>.bbcnews")
; Type 2 = ASCII
set A to 104
.outputframes
  appendframe(A, 2)
  filewritebyte(10)
  filewritebyte(10)
  A++
  if(A [ E) go("outputframes")
fileclose()
filetype("<Teletext$Temp>.bbcnews", &FFF)
Because the output file is a 'text' file, running it will load it into an editor - possibly !Edit, but maybe !Zap or !StrongEd, etc...
; Call the OS to execute a command
oscall("%Filer_Run <Teletext$Temp>.bbcnews")

; done!
terminate()

Return to !Teletext index
Copyright © 2003 Richard Murray