Home Page Bray Script: Overview shopping cart
site currency

currency info
spacer Home spacer Barcode Mill spacer Barcode Fonts spacer How to order spacer Email us spacer

For 30 years I have been helping organisations and individuals with their Barcode and Auto ID issues but now I have decided it is time to move on and retire from being the Barcode Man.

I will continue to respond to emails from existing customers about their earlier purchases, their special programming configurations and warranty issues but I regret I cannot help with new purchases or issues nor recommend alternative products or sources.

Lee Allen, The Barcode Man. February 2010

Web This site

Mule Resources

bulletMule Home
bulletMule Dispatcher
bulletBray Overview
bulletBray Basics
bulletBray Script Index
bulletBray DLL
bulletKeyboard Emulator
bulletKeyboard Scan Codes
bulletMule Quickstart
bulletTechnical Manual
bulletEngineering details
bulletLegacy Tech Manual
bulletLegacy downloads

The Mule is a trademark of Altek Instruments Ltd

Support Services

bulletTechnical Support
bulletHow to Order
bulletEmail us
bulletWho we are
bulletPolicy Statements
bulletSpam email from here?

"To talk to a Mule you have to Bray..."

What is Bray

Bray is a simple scripting language used to communicate with The Mule. Through it you can control another computer for a variety of automated tasks including control, testing, data collection and monitoring.

A Bray interpreter is built into our free software application The Mule Dispatcher.

Bray is designed to make it easy to work with The Mule. It borrows some of the ideas and syntax from a numer of computer languages so it will seem familiar to experienced computer programmers. One of our primary goals is to keep it simple and transparent so anyone can feel comfortable using it within a very short time.

Although we retain the rights to publish, maintain and update the Bray Specification we have placed the Bray Language in the public domain. You are free to write your own application based around a Bray kernel. You can use The Mule and Bray to provide your clients with a tailored solution to many complex control tasks. You never need pay us any royalties. We even provide a free DLL (Dynamic Link Library) containing the whole Bray interpreter to assist you with this. Get in touch if you think we should include a new feature in Bray, all ideas welcome.

Writing a Bray script

Bray is simple - it does not need a dedicated development system. Testing is done using the Mule Dispatcher.

A Bray script consists simply of lines created in any text editor. Save your scripts as normal PC style text files. (Line ends CRLF - not Unix style LF)

If you do not have a programmers text editor you can use the Notepad application provided as part of the Microsoft Windows operating system. Word Processors are not recommended because they usually store files using proprietory formats.

Is Bray hard to learn?

Right from the start the thinking behind Bray was to make it simple, intuitive and easy to use for both programmers and non programmers.

Bray is the simplest language you can get. It consists of a handful of keywords and the syntax is self evident. You can write your first script in a couple of minutes.

Hello World in Bray

Here is a 'Hello World!' Bray Script. It sends the words Hello World! (followed by a carriage return) out to a Mule connected to the first COM port. The Mule then creates the keystrokes to generate that same text on a second computer.

"Hello World!{ret}"

Notice how the COM port setup and RS232 handshake are all handled automatically. You just tell it which COM port to use. Bray takes care of the rest.

Notice how Bray automatically operates the keyboard shift key where necessary. You just send the text as a regular ACSII string.

But perhaps you need to generate keystrokes which have no ASCII equivalent. Its just as easy. Here is the same program again but this time the keys F1 and then F2 are generated after the carriage return.

"Hello World!{ret}"

That seems easy enough but what about if you need to pause between keystrokes so the receiving computer has time to react - maybe it needs to load a program or display a message for a few moments giving time for it to be read. Simple again. This time the script pauses 1 second before the F1 key and 2.5 seconds before the F2 key.

"Hello World!{ret}"

Notice how this time we have used lower case letters for the PORT command. Thats because Bray is not case sensitive. It does not care if you use capitals, lower case or even a mix of upper and lower. Professional programmers often prefer to use lower case because its easier and quicker. Bray is happy to oblige.

Top Home            © Lee Allen, 2017