Are there any more app scripting examples other than this one

Are there any more app scripting examples other than this one:

Preferrably some actual scripts that I can look at

What are you looking for? If it’s writing Bash scripts, there’s lots of info out there in Unix land. By the way, I found the til() function that Camusensei made at useful, and it shows you what a larger Bash script looks like.

If you want to write a Haiku/BeOS application that responds to scripting messages, there is lots of example code around. My example is, see the code for how programming is done and see the help docs for the user side of using app scripting.

If you want to use scripting to control applications, usually you use bash and use “hey” commands to control the application. It can be fancy, or just something to press the Record button in SoundPlay. Combine that with the til() function and you have timed audio recording.

I think I might have been looking for something more like QML. I think that’s really what I was expecting as well.

But now I’m thinking that something like EDC might be a better fit. Is it possible to write a script like an EDC script in Haiku?

Might help if you gave an example or two of what you think of as a “script”. Aside from bash scripts for fairly simple things, I use Ruby – or sometimes Python – scripts a lot. You can do essentially anything with them, and they’re standard languages.

If you’re thinking of scripts with some kind of graphic input, there’s no ‘canonical’ way to do it in Haiku. But there’s my ‘Gadgeteer’ app ( ) that lets you attach a panel with buttons and text fields to a script (in any language, I think). bbjimmy has an alternative that is based on YAB.

While I’m at it I’ll also tout “xicon” :slight_smile: ( ) My desktop is littered with xicon scipts, mostly one-liners for such common jobs as logging in to my ISP, but there are some more complex utilities thare are in steady use.

I actually was. I was actually thinking something like this:

collections {
group { name: “e/modules/battery/main”;
images {
image: “battery.png” COMP;
image: “battery_fill.png” COMP;
image: “battery_charging.png” COMP;
script {
public message(Msg_Type:type, id, …) {
if ((type == MSG_FLOAT) && (id == 1)) {
new Float:val;
val = getfarg(2);
set_drag(PART:“fill_knob”, val, 0.0);
if (val < 0.2)
set_state(PART:“clipper”, “low”, 0.0);
set_state(PART:“clipper”, “default”, 0.0);

and using QML it’s something like:

\brief A floating action button.

An ActionButton is a floating action button that provides a primary action
on the current page.
Controls.Button {
id: button

visible: action ? action.visible : true

   The color of the action button. By default, this is the accent color of your
   app as defined by \l Theme::accentColor.
property color backgroundColor: Theme.accentColor

   The elevation of the icon. This will be higher for a white background color.
property int elevation: backgroundColor == "white" ? 0 : 1

   The color of the icon displayed on the action button. By default, this is
   automatically selected based on the \l backgroundColor.
property color iconColor: Theme.lightDark(button.backgroundColor,


But then I saw how the BeDecorator was put together:

\brief Draws a bevel around a rectangle.
\param rect The rectangular area to draw in.
\param down Whether or not the button is pressed down.
\param light The light color to use.
\param shadow The shadow color to use.
engine, const BRect rect, bool down,
rgb_color light, rgb_color shadow)
if (down) {
BRect inner(rect.InsetByCopy(1.0f, 1.0f));

	engine->StrokeLine(rect.LeftBottom(), rect.LeftTop(), shadow);
	engine->StrokeLine(rect.LeftTop(), rect.RightTop(), shadow);
	engine->StrokeLine(inner.LeftBottom(), inner.LeftTop(), shadow);
	engine->StrokeLine(inner.LeftTop(), inner.RightTop(), shadow);

	engine->StrokeLine(rect.RightTop(), rect.RightBottom(), light);
	engine->StrokeLine(rect.RightBottom(), rect.LeftBottom(), light);
	engine->StrokeLine(inner.RightTop(), inner.RightBottom(), light);
	engine->StrokeLine(inner.RightBottom(), inner.LeftBottom(), light);
} else {
	BRect r1(rect);
	r1.left += 1.0f;  += 1.0f;

	BRect r2(rect);
	r2.bottom -= 1.0f;
	r2.right  -= 1.0f;

	engine->StrokeRect(r2, shadow);
		// inner dark box
	engine->StrokeRect(rect, shadow);
		// outer dark box
	engine->StrokeRect(r1, light);
		// light box


And, I really thought that, instead of doing that way, it really is better to do it using scripts like QML or EDC. because it’s still kinda the same thing, only not exactly, since the BeBook says that you can do the scripting thing like this:

BMessage message, reply;
BRect result;

// set the command constant
message.what = B_GET_PROPERTY;

// construct the specifier stack
message.AddSpecifier(“Frame”); // B_DIRECT_SPECIFIER
message.AddSpecifier(“View”, 1); // B_INDEX_SPECIFIER
message.AddSpecifier(“Window”, “egg”); // B_NAME_SPECIFIER

// send the message and fetch the result
BMessenger(“application/x-fish”).SendMessage(&message, &reply);
reply.FindRect(“result”, &result)

So I was really wanting to see if there where any scripts like the BeBook one so as i could see how it was done in Haiku. Considering that they’re reimplementing the BeOS API thought that they would have quite a few lying around. An yeah I really was thinking about the graphical thing, like how KDE uses QML or Gnome uses VALA. And how Enlightenment uses EDC to define it’s GUI.

There is also lesson 18 and 19 from this guide: