main page

This is a list of commands babelscript current supports. It is possible to add arbitrary new commands, since any file "xyz.bls" will be used as a new command xyz (see below section Library commands). In general, each parameter of a command may contain variables (enclosed in curly brackets { }) or constant text or both, the examples show only the normal usage.
  1. Native commands
    1. String processing
    2. Flow control
    3. I/O
  2. Library commands

Native commands

  1. String processing

    In babelscript, strings are written without quotation marks and any string variables are directly inserted into these strings. The parser recognizes variables by means of curly brackets. The following special string variables may be used:

    - {newline} means a line feed character. When searching for it with find, it also matches the sequence CR-LF.
    - {tab} is a tab character.
    - {empty} is the empty string.
    - {blank} is a space character.
    - {app} is the path to the babelscript installation folder (without trailing slash)
    - {temp} is the system's temporary folder (without trailing slash)
load http://en.wikipedia.org as {page}
striphtml {page}
find Welcome to {text}.{blank} in {page}
print {text} // will print "Wikipedia, the free encyclopedia that anyone can edit"
load http://en.wikipedia.org as {page}
striphtml {page}
print {page}
load http://en.wikipedia.org as {page}
removetag script from {page}
removetag span class="mw-headline" from {page}
save {page} as wikipedia.html
load http://en.wikipedia.org as {page}
utf8toascii {page}
save {page} as wikipedia.html
  1. Flow control

load http://en.wikipedia.org as {page}
loop
    find <a href="/wiki/{internalLink}" in {page}
    print {internalLink} // prints a list of page names of all internal links on the wikipedia main page
repeat
  1. I/O

open http://www.google.com // opens web site in the browser
open test.jpg // opens image test.jpg in the associated image viewer
open {variable} // opens the content of {variable}. If {variable} begins with http:// or file:///, the link target will be opened.
open C:\windows\regedit.exe with /e {temp}\startup.txt HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run // list Windows startup entries

Library commands

If a script contains an unknown command, first the current directory is searched for scripts with the name of the command plus extension ".bls". Afterwards the directory library in the babelscript application folder is searched. If a script is found, it will be called.

Inside a user-defined command script two special variables may be used:
The calling script must use the keyword as to seperate two parameters. Alternatively library commands with one parameter or no parameters are allowed. The following command scripts are part of the current distribution: