Hey GETSUITES

I get nothing from “hey <team_id> GETSUITES”, for anything I tried. print_server, per the online example from a ways back. Clock. Terminal, which is what I actually wanted. (R1/Beta2, x86_64.)

I don’t think it’s hey’s fault, as a rudimentary C++ program gets the same empty suites reply message. Is there any server or application, would anyone happen to know, that responds to this message? Is there a better way to discover what features the application exposes for scripting?

Works here (32bit though). Are you sure the team_id you used is correct? It also works with the app name or signature. For example, hey Clock getsuites.

The blog post Scripting the GUI with ‘hey’ may be helpful.

Often, apps aren’t that well prepared for scripting and you need to study the MessageReceived() functions in their source to trigger the right BMessage.

One app that does offer nice scripting capabilities is MediaPlayer:

~/Desktop> hey MediaPlayer getsuites of Window 0

Reply BMessage(B_REPLY):
   "suites" (B_STRING_TYPE) : "suite/vnd.Haiku-MediaPlayer"
   "suites" (B_STRING_TYPE) : "suite/vnd.Be-window"
   "suites" (B_STRING_TYPE) : "suite/vnd.Be-looper"
   "suites" (B_STRING_TYPE) : "suite/vnd.Be-handler"
   "messages" (B_PROPERTY_INFO_TYPE) : 
        property   commands                            specifiers              types
---------------------------------------------------------------------------------------------------
            Next   B_EXECUTE_PROPERTY                  DIRECT                  
                   Usage: Skip to the next track.
            Prev   B_EXECUTE_PROPERTY                  DIRECT                  
                   Usage: Skip to the previous track.
            Play   B_EXECUTE_PROPERTY                  DIRECT                  
                   Usage: Start playing.
            Stop   B_EXECUTE_PROPERTY                  DIRECT                  
                   Usage: Stop playing.
           Pause   B_EXECUTE_PROPERTY                  DIRECT                  
                   Usage: Pause playback.
   TogglePlaying   B_EXECUTE_PROPERTY                  DIRECT                  
                   Usage: Toggle pause/play.
            Mute   B_EXECUTE_PROPERTY                  DIRECT                  
                   Usage: Toggle mute.
          Volume   B_GET_PROPERTY B_SET_PROPERTY       DIRECT                  FLOT 
                   Usage: Gets/sets the volume (0.0-2.0).
             URI   B_GET_PROPERTY                      DIRECT                  CSTR 
                   Usage: Gets the URI of the currently playing item.
     TrackNumber   B_GET_PROPERTY                      DIRECT                  LONG 
                   Usage: Gets the number of the current track playing.
ToggleFullscreen   B_EXECUTE_PROPERTY                  DIRECT                  
                   Usage: Toggle fullscreen.
        Duration   B_GET_PROPERTY                      DIRECT                  LLNG 
                   Usage: Gets the duration of the currently playing item in microseconds.
        Position   B_GET_PROPERTY B_SET_PROPERTY       DIRECT                  LLNG 
                   Usage: Gets/sets the current playing position in microseconds.
            Seek   B_SET_PROPERTY                      DIRECT                  LLNG 
                   Usage: Seek by the specified amounts of microseconds.
PlaylistTrackCount   B_GET_PROPERTY                      DIRECT                  SHRT 
                   Usage: Gets the number of tracks in Playlist.
PlaylistTrackTitle   B_GET_PROPERTY                      INDEX                   CSTR 
                   Usage: Gets the title of the nth track in Playlist.

…and more.

In fact I did try that specific example. And print_server.

$ hey MediaPlayer getsuites of Window 0
$

I guess I should file a bug report.

Well, I reckon if they aren’t that well prepared, it’s likely because no one cared to support any useful scripting functionality. Which is the common case anyway, but you never know. For example, it had occurred to me that while Terminal doesn’t appear to support size change via the pseudo-ANSI < CSI 8 ; nr ; nc t > sequence, it might export that as a scripting feature. I wouldn’t expect any joy from fiddling with View parameters, more likely that would have to be supported directly by the application, and I’d have to ferret it out with getsuites.

print_server scripting is currently broken. I will submit patch later.

Any app’s window responds to some standard messages, like Minimize, MoveTo, ResizeTo etc. Terminal doesn’t provide anything special there, like resizing to number of chars/lines etc.
Setting the size explicitely is also always possible:

hey Terminal set Frame of Window 0 to "BRect(1000.0, 50.0, 1300.0, 500)"

Yeah, that’s what I mean - I’m not that desperate. Dragging the window border is kind of cranky because of the flickering size popup, and it’s almost as bad in that it doesn’t seem to know anything about the view’s row and column structure, but at least you’re looking at it, so font size etc. is automatically factored in.

Is there any user manual of hey, with some practical examples?

Nothing other than the odd blog post here and there and the Scripting Chapter of the BeOS Bible, I think.

1 Like

Hmmm… does anyone get the commands MoveTo, ResizeTo etc. to work, that are returned by windows when asked to getsuites?