Radio Eyes Help
Writing Active Label scripts does not take the skills of a great programmer. Anyone can write these scripts using a simple text editor such as notepad. The number of script commands is limited so there is no huge language to learn. However, you must be careful as you write the script. Punctuation and spelling do count! You also need to be exact about the parameters that you pass to the script commands. Adding an extra space after a command's = sign, might mean the difference between the script working and not working.
Scripts may be written with any text editor that will output a simple ASCII text file. You can't use Word or other word processors unless you specify that the output is simple text! Scripts should always be saved in the subdirectory of the Radio Eyes program called Label Scripts. The full path will usually be:
C:\Program Files\Radio Eyes\LabelScripts\
You must also save the file using the extension RLS.
Active Label Script Commands
' Lines beginning with the single quote will be ignored
REM Lines beginning with REM will be ignored these
are lines where you can add remarks
' ***** Pre-retrieval Commands ******
LS_Timeout = Number of seconds before timing out.
LS_Picture The default input type is Text
Add this line if you want a picture.
LS_Width = Width in pixels of a picture.
Picture will be stretched/shrunk to this width.
LS_Height = Height in pixels of a picture. Picture
will be stretched/shrunk to this height.
LS_Redirect = URL to which to open a browser when
the picture or text is double clicked.
' ***** Retrieval Commands *****
LS_URL = Source URL
LS_File = Source is a file name if from a
local file.
' ***** Post Retrieval Commands *****
LS_Pause = Number of seconds to pause before next command.
LS_Before = String found before desired text. Use
with LS_BeforeEnd tag.
LS_BeforeEnd tags the end of before string
LS_After = String found after desired text. Use with
LS_AfterEnd tag.
LS_AfterEnd tags the end of the after string
LS_Trim Remove spaces before and after retrieved string.
LS_RemoveUnprintable - Remove all characters below ASCII #32
LS_AddBefore = Add this text before output.
LS_AddAfter = Add this text after the output.
LS_Text = Force this text to appear. Appears as
tooltip text in picture label scripts.
LS_End End label script here.
Note all commands with = signs expect a parameter to follow on the same line.
Text Example:
Let us say we want an active label that will tell us in a glance if the Nancay TP array is tracking the Sun or Jupiter. We know that there is a page on the Nancay web site that tells us this information in text form. It always appears along with the spectrographic image. So we browse to this page. It is not at once clear what the URL for the page is but we can find out by Right Clicking in the browser on the page and selecting Properties. From this we find out the URL is: http://www.obs-nancay.fr/cgi-bin/ion-p?page=dam_pointage.ion . This is our first important piece of information for making the active label.
Next we are interested only in the text states whether or not the antenna is tracking and if so whether it is tracking the Sun or Jupiter. Our strategy is to be able to isolate this text from the raw HTML code that the web site is feeding to our browser. This code is also called the page "Source". To grab the page source we can Right Click on the page in the browser with the mouse and select View Source. In the Internet Explorer browser this brings up a copy of notepad.exe and supplies it with the page source. Perfect! We have the information we need right in a text editor.
For this particular example the retrieved page source was:
<HTML>
<BODY BACKGROUND="http://www.obs-nancay.fr/images/fond.jpg">
<META http-equiv="refresh" content="30">
<TT><FONT COLOR=#000000><B>Fri Apr 8 06:47:24 2005</B></FONT></TT><BR>
<BR><B><TT><FONT COLOR="#0000FF" SIZE=+1>No tracking</FONT></TT></B><BR>
</BODY>
</HTML>
At this point it helps if you understand HTML a bit but it is not absolutely
essential. We look through the source code and see "No
tracking". Yes, that was the text we were interested in grabbing for
our active label. This text would change depending on what the Nancay antenna
was doing. What we hope does NOT change is the code around the text
because we want to use this code to help us find the dynamic text. This is
a requirement of this type of active label extraction.
As mentioned previously, you create the Active Label Script in a text editor, so lets open up another copy of notepad to use as our editor. If you want you can load a file from the Active Labels directory called Template.rls into this copy of notepad. This template has all of the commands in it, each preceded by a single quote so that the command will be ignored. Having the commands in the template like this makes it easy to copy them into our own script.
So let's start writing our script. In the list of commands we see Pre-Retrieval Commands, that is, commands we might use before we actually grab the information from a URL or a File. The only one that will apply to our text grabbing Active Label is LS_Timeout = . We have a pretty good internet connection so our guess is that if the info cannot be retrieved in 10 seconds, then there must be a problem, so let's set this value to 10 seconds.
LS_Timeout = 10
Here it does not matter if we have a space after the equal sign before the 10 parameter, but it will matter for other commands later as you will see. The next thing to do retrieve the page from the internet URL so we add this line:
LS_URL = http://www.obs-nancay.fr/cgi-bin/ion-p?page=dam_pointage.ion
Now we need to deal with extracting the text we want from the returned web page. Looking at the example of the returned page source above we see that we can uniquely identify our desired text by a short amount of text before it and and short fragment after it. The next line of the script identifies the before fragment:
LS_Before =SIZE=+1>LS_BeforeEnd
Do you see how this line of the script was formed? It begins with the tag LS_Before = and is immediately followed by the fragment SIZE=+1> taken from the page source. We probably could have used a shorter fragment; 1>, looks to be unique in the page source, but we are just trying to make this easy to follow as an example. We must tag the end of our fragment with the command LS_BeforeEnd. No spaces are used after the equal sign or before the closing command unless they actually make up part of the fragment! This is very important.
Now we have marked where our text starts in the page source and we must follow this with a command describing were the desired text ends.
LS_After =</FONT>LS_AfterEnd
Again a shorter fragment could have been used, but this will also work. These commands have successfully isolated the text we want in our Active Label. We could use LS_Trim or LS_RemoveUnprintable commands to remove spaces and nasty things like carriage returns if we had needed to but no need to do that for this example. Finally lets add a bit of our own text before the text we are retrieving from Nancay.
LS_AddBefore =Nancay Status:
You can't see it but there is a space typed after the colon (: ) because we don't want this added text to run into the retrieved text. We could use LS_AddAfter to add text after the retrieved text if we wanted to. So here is our entire script:
LS_Timeout = 10
LS_URL = http://www.obs-nancay.fr/cgi-bin/ion-p?page=dam_pointage.ion
LS_Before =SIZE=+1>LS_BeforeEnd
LS_After =</FONT>LS_AfterEnd
LS_AddBefore =Nancay Status:
Pretty simple really! We save this file in our LabelScripts directory using the extension RLS.. Let's call it Nancay_Status.RLS. After following the instructions for adding the new Active Label, you might have the label appear on the skymap something like this:
My goodness! In the time it took to write this script the content went from No Tracking to Telescope is now tracking the Sun. Well it is an Active Label after all!
For an example of an active label using a picture click here.