Haiku scripting

My impression is that “hey” is a Haiku-native command-line utility that allows interprocess communication. It is not present on other operating systems.

It’s not without precedent on other operating systems: OS/2, AROS and AmigaOS 2 and 3 used their respective versions of the REXX scripting language for interprocess communication while AmigaOS 4 uses a proprietary Python plugin to access “AREXX ports” and MorphOS uses a similar “AREXX port” plugin to it’s version of Lua. There’s AppleScript on the Mac and ActiveX on Windows also.

Having a single “hey” command that can be called from any scripting language is much simpler than building a whole scripting language around it.

I’aint the right person to answer to this, but with ‘hey’ one can message a non native application to apply commands to a window, move, resize etc.

hey is only one frontend to the scripting API. There used to be a similar tool in the early days of BeOS that I can’t remember the name of. The scripting API isn’t really about interpreted languages like shell/ruby/perl/python/… scripts. Scripting is more about a “scripted conversation” between two objects. Non-native apps will not know how to respond to these script requests, although any app that opens a window will inherit some basic commands to manipulate the application windows and a few other properties. So, ported apps using toolkits like Qt or SDL will inherit the basics, but won’t truly support the full power of the scripting API.

https://birdhouse.org/beos/bible/bos/ch_scripting1.html

this replicates what “open origin package” tracker’s add-on does, i’m using it paired with Filer, to open, and uninstall, a given package

3 Likes

Really nice ! :slight_smile:

1 Like

You can cheat a bit if you’d like. There is a special flag to the findpaths command that will look up the package file for you, without having to use catattr. Something like findpaths -p /path/to/file B_FIND_PATH_PACKAGE_PATH will print the path to the hpkg that owns it. This also has the advantage of being usable for things installed to the user package directory at ~/config/packages.

3 Likes

It means adding the below function in the profile file will do the trick :slight_smile:

openpackage()
{
  if [ $# -ne 1 ]; then
    echo "Usage: openpackage <application-path>"
    return 1
  fi
  open `findpaths -p "$1" B_FIND_PATH_PACKAGE_PATH`
}
1 Like

I noticed the latest version is not working and the open command must be used like below :

open ${pkg_src}