Haiku scripting

Sure, I tried how a replicant for calendar could be possible just using yab, actually I started this script over ten years ago when Michael Lotz published his libbsvg, this had a scriptable and replicable svg viewer, so although there was no interaction it was quite useful … I recently got my hands back on this old file and wondered how the haiku calendar handled events and since it uses indexed attributes, with some changes from the original this script works flawlessly with this; my script lacks an interface to adjust some choices on the fly (move the timeline to the past or future, expand or reduce the time frame, move events in the timeline), but a real programmer can create something useful … and as far as I know, an helicoidal timeline is not used anywhere else, so it could be a distinctive element for haiku

1 Like

Here some tips to create packages (not all tutorials point to you problems but can help to understand and how to solve some things).

yab is a script language and you does not need to build an executeable file for it, so long you does not want to protect you source for others. You only need to add yab as dependeciens to you package to install.

1 Like

@zuMi: I often use a little c program to start yab with my yab-script, so you have an executeable with icon in the boot menu and not a .sh file there ;-).

Run a shell script or command with C


#include <stdio.h>

int main (void)
{
    system ( "cd /boot/Apps/appname; yab /path/to/yab/script.yab" ) ;
}
1 Like

There is no need to add the .sh at the end, and you can add icons to scripts easily aswell, so this seems a bit uneccesary.

if yab ignores # on the first line of a script you might be able to add #!yab as a shebang directly too

This is simply because I used to forget to make the script executable and at the end I had to write the new package, I change to the directory via the c file and then run the sprit. It’s just a matter of convenience :wink:.

the C file also has to be marked executable

I compile it to an executeable, no need to make it bootable.

I usually i don’t build the script, but I just bind it especially to register the file types and open files with tracker’s “open with”, but just a few script I made could have benefits from this feature, so in most cases I run it as a plain script

Not sure what you mean by bootable, but every executable and script has to be marked executable if you want to run it. Sometimes tracker does this automatically for you.

gcc -o outputfile input.c

Nothing more to do

Yes, gcc does this too. But that is a bit comparing apples to oranges imo, marking as executable is much faster and less work than writing a C programm and compiling :slight_smile:

As I said, was annoyed to renew packages, after publication, because not executable… just forgot, not anymore :wink:.
Could also have bound the yab script to yab, but there were always changes to yab that made it necessary to rebind all programs and I didn’t want to do that anymore.
My programs can also be viewed, others can learn from them.

So back to main discussion :slight_smile:

Maybe adding the executable flag to the scripts could be a feature-idea for your hpkg maker.

2 Likes

Bitmap
My progress so far, just wondering why the columnbox sorts the last column oddly

4 Likes

These time rings are making me think about the time machine in The time tunnel series. In French, the series was called Au coeur du temps and the device was called a chronogyre. You can see how it was looking here.

Looks nice.

The columnbox of yab is not the best at all.

How to enter the data for the events?

A very good idea. I will add this in next release. It is interesting for all files the user wants to change the permisson creating the package.

That looks like a reverse lexicographic (dictionary) sort to me. I’m not sure if the YAB columnbox supports a custom comparator…

how do you get the round image? it is similar to a linux disk usage app i’ve seen. it’s a good way to represent stuff. More apps should be round - afterall, we live on a round planet, so it’s natural. :smiley:

If one wants to create numerous round figures/apps like this, would there be a boilerplate script/function for it within popular programming languages that you could just call up by name and tweak - like in python?

I guess that you mean like Haiku DiskUsage app…
To be honest, it’s a representation often used in drive usage apps. In twenty years, people will start wondering why this shape but, for the moment, we are still a few to remember that drives were made of disks. :smiley: