Within BRexx, the syntax of BeOS-native scripting commands is:
address <app|signature> "<verb> <specifier_1> <of <specifier_n>>* [to <value>]
[with name=<value> [and name=<value>]*]"
where <verb> : get|set|count|create|delete|getsuites|quit|save|load|execute|'what'
<specifier> : <property_name> [ '['index']' | '['-reverse_index']' |
'['fromvalue to tovalue']' | name | "name" ]
<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)
address "Application" "_ABR"
will open the about window of the application.load and save are actually not scripting commands, they are standard BeOS messages. They are included for convenience. E.g. open a file in Application (the path can be relative or absolute):
address "Application" "load file(/boot/home/images/Be.jpg)"
or save it:
address "Application" 'save Window "Be.jpg"'
Whether the application does something with these messages is a different story.
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:
address "Application" "get Window 0"
address "Application" "set .... to BPoint(100,100)"
You can also use square brackets:
address "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.
address "Network" "getsuites"
do i = 1 to result.0
say result.name.i result.type.i result.i
end
This prints the BApplication and BHandler suites.
address "Network" "get Name"
say result
address "Network" "_ABR"
address "Network" "get Window [0]"
say result
or you can omit the square brackets when using an index:
address "Network" "get Window 0"
say result
or you can specify a window name:
address "Network" 'get Window Network'
say result
address "Network" 'getsuites of Window Network'
do i = 1 to result.0
say result.name.i result.type.i result.i
end
for the description of suite/vnd.Be-window see the BeBook.
address "Network" 'get Title of Window Network'
say result
address "Network" 'get Frame of Window Network'
say result
address "Network" 'set Title of Window Network to "hey is great"'
Note that the above changes the name of the window, and so it is best to set it back to "Network", or else the following commands won't work.
address "Network" 'set Frame of Window Network to BRect(0,0,300,300)'
or
address "Network" 'set Frame of Window Network to BRect[0,0,300,300]'
(You will get an error for these last two, since the Network preferences window is not resizable. However, it works with NetPositive's windows).
address "Network" 'getsuites of View 0 of Window Network'
do i = 1 to result.0
say result.name.i result.type.i result.i
end
For a description of suite/vnd.Be-view see the BeBook.
As we get to more complicated commands, you should see them as samples only. Most of them do not work with later versions of BeOS, because the layout of of the Network prefs application has changed.
address "Network" 'get Frame of View 0 of Window Network'
say result
address "Network" 'get Hidden of View 0 of View 0 of Window Network'
say result
address "Network" 'get Label of View 5 of View 0 of Window Network'
say result
address "Network" 'get Value of View 0 of View 2 of View 0 of Window Network'
say result
address "Network" 'get Text of View 2 of View 2 of View 0 of Window Network'
say result
address "Network" 'set Frame of View 0 of Window Network to BRect(0,0,100,400)'
address "Network" 'set Hidden of View 0 of View 0 of Window Network to true'
address "Network" 'set Label of View 5 of View 0 of Window Network to "Restart Something"'
address "Network" 'set Value of View 0 of View 2 of View 0 of Window Network to 1'
address "Network" 'set Text of View 2 of View 2 of View 0 of Window Network to "joe"'
address "Network" 'quit Window Network'
address "Network" "quit"