hey version 1.2.8


What is hey?

hey is a small public domain scripting utility which works with standard BeOS scripting. It comes with source which you can modify as you wish. If you want your modification in the standard distribution, just drop me a line. Use it at your own risk.


Installation


Usage

hey should be used from Terminal. When you start it without parameters it will display the command line syntax it accepts:

hey v1.2.8, written by Attila Mezei (attila.mezei@mail.datanet.hu)
usage: hey [-s][-o] <app|signature|teamid> [let <specifier> do] <verb> <specifier_1> <of
           <specifier_n>>* [to <value>] [with name=<value> [and name=<value>]*]
where  <verb> : DO|GET|SET|COUNT|CREATE|DELETE|GETSUITES|QUIT|SAVE|LOAD|'what'
  <specifier> : [the] <property_name> [ <index> | name | "name" | '"name"' ]
      <index> : int | -int | '['int']' | '['-int']' | '['startint to end']'
      <value> : "string" | <integer> | <float> | bool(value) | int8(value)
                | int16(value) | int32(value) | float(value) | double(value)
                | BPoint(x,y) | BRect(l,t,r,b) | rgb_color(r,g,b,a) | file(path)
options: -s: silent
         -o: output result to stdout for easy parsing


The verb

The verbs send the following messages: You can use your own verbs if you specify the value names and constants in the 'value_info' structure. See BPropertyInfo and PropertyInfo.h for details.

Note that the verb is not case sensitive but the specifier names (e.g. "Frame", "Label"...) are. You can use 'what' constants directly, like

hey Application '_ABR'
will open the about window of the application.

LOAD and SAVE are actually not scripting commands, they are standard BeOS messages (B_REFS_RECEIVED and B_SAVE_REQUESTED). I included them for convenience. E.g. open a file in Application (the path can be relative or absolute):

hey Application load 'file(/boot/home/images/Be.jpg)'
or save it:
hey Application save Window "Be.jpg"

The specifier

The specifier can be direct, index, reverse index, range or named. Reverse range is not supported. If you enter an index which consists of only digits, you can omit the square brackets:

hey Application get Window 0

The value

It is easy to use the type names in front of the value but beware that the shell will throw a syntax error if you do this:
hey Application set .... to BPoint(100,100)
Instead use square brackets or quotes:
hey Application set .... to BPoint[100,100]
hey Application set .... to 'BPoint(100,100)'
If the value string contains only digits, it will be considered an int32. If it contains digits and a dot, a float type is assumed. "true" or "false" can also be used as bools.


DEBUG mode

You can check the message to be sent to the application by setting the DEBUG_HEY preprocessor symbol to 1, and recompiling.


History

v1.2.8 v1.2.7 v1.2.6 v1.2.5 v1.2.4 v1.2.3 v1.2.2 v1.2.1 v1.2.0 v1.1.1 v1.1.0 v1.0.0


Examples

For these examples you need to start the Network preferences application (the classic way to demo scripting ;-)

Get the messenger of an application (not useful if you use 'hey'):

	hey Network get Messenger

Get the suite of messages which the application can handle:

	hey Network getsuites

Get the name of the application

	hey Network get Name

Open the about window of the application

	hey Network '_ABR'

Get a window of the application (actually a messenger for the window)

	hey Network get Window [0]
	hey Network get Window 0
	hey Network get Window "Network"

Get the suite of messages which the window can handle:

	hey Network getsuites of Window "Network"

Get the title, frame or other properties of the window:

	hey Network get Title of Window "Network"
	hey Network get Frame of Window "Network"

Set the title, frame or other properties of the window:

	hey Network set Title of Window "Network" to "hey is great"
	hey Network set Frame of Window "Network" to 'BRect(0,0,300,300)'
	hey Network set Frame of Window "Network" to BRect[0,0,300,300]

Get a view from the window (actually a messenger for the view)

	hey Network get View 0 of Window "Network"

Get the suite of messages which the view can handle:

	hey Network getsuites of View 0 of Window "Network"

Get a view property:

	hey Network get Frame of View 0 of Window "Network"
	hey Network get Hidden of View 0 of View 0 of Window "Network"
	hey Network get Label of View 5 of View 0 of Window "Network"
	hey Network get Value of View 0 of View 2 of View 0 of Window "Network"
	hey Network get Text of View 2 of View 2 of View 0 of Window "Network"

Set a view property:

	hey Network set Frame of View 0 of Window "Network" to 'BRect(0,0,100,400)'
	hey Network set Hidden of View 0 of View 0 of Window "Network" to true
	hey Network set Label of View 5 of View 0 of Window "Network" to "Restart Something"
	hey Network set Value of View 0 of View 2 of View 0 of Window "Network" to 1
	hey Network set Text of View 2 of View 2 of View 0 of Window "Network" to "joe"

Close a window in an application

	hey Network quit Window "Network"

Quit an application

	hey Network quit