honk 


a utilty for using BigHonkingText


version 2008-02-15


This method uses the OSX UNIX utility BigHonkingText, which displays text in a similar way to the "Large Type" display option within Address Book.  


The implimentation here works in a similar way to postln, except that Strings get displayed by BigHonkingText insetad of in the Post Window.


"Hello world".honk;

(If "Hello world" is posted to the post window only, BigHonkingText is not installed, or not in a recognised directory.)


The utility is not installed by default within OSX, it is available (104KB) at

http://homepage.mac.com/shayman/FileSharing44.html

(link checked 2008-02-15)


BigHonkingText needs to be installed some place that SC knows about. The source code above assumes it is in ~/bin by default (make this dir if it doesn't already exist, or put it elsewhere and change the path variable in source above).


honk does not use all of BigHonkingText's options (see its Help file below).  height and other dimensions are stipulated as percentages of screen dimensions, with values between 0 and 1.


Examples


a = "Hello world"


a.honk


a.honk(p: 0.5, h: 0.15, w: 1, x: 0, y: 0.82, b: "orange", o: 0.8);


a.honk(h: 0.05, w: 0.15, x: 0, y: 0.1, f: "red", o: 0.3);


// Autopilots


// _f0

(

Routine({

4.do{

"warning".honk(p: 0.5, h: 0.8, w: 1, x: 0, y: 0.1, b: "red", o: 1);

1.wait;

}

}).play(AppClock)

)




(

var a, b, f, g, h;

a = ["world", "is", "", "the", "case", "everything", "that", "is", "the"];

f= ["black", "darkGray", "lightGray", "white","gray", "red", "green", 

"blue", "cyan", "yellow", "magenta", "orange", "purple", "brown"];

h = f.reverse;

b = {var h; h= a.scramble; h[0]+h[1]};


r = Routine.new{

50.do({ |i|

(b.value).honk(

p: rrand(0.2, 2), 

h: rrand(0.1, 0.5), 

w: rrand(0.1, 1), 

x: rrand(0, 0.4), 

y: rrand(0, 0.8), 

b: h.wrapAt(i), 

f: f.wrapAt(i), 

o: rrand(0.1, 0.7));

rrand(0.2, 0.25).wait

})

}.play

)



//////////////


The BigHonkingText help file:


Usage: BigHonkingText [-p secondsToWait] [-h height] [-w width] [-d] [-H] message

BigHonkingText 0.98


Options:

   -h windowHeight

   -w windowWidth

          height and width can be either pixels,

          or percentages of the screen size.

          The default is  -w 90% -h 20%  

   -x xposition

   -y yposition

          Specify lower left corner of window.

          You can specify either pixels, or precentages of the screen size.

          If unspecified, window will be centered.

   -m     Ignore mouse clicks. Window stays put.

   -M     Ignore mouse clicks AND allow the user to move the window around.

            By default, mouse clicks make the window go away.

   -p N   Wait for at most N seconds. Use -p 0 to wait forever.

          The default is to display the message for 3 seconds.

   -d     detach and run in the background

   -f col Set the foreground (text) color.  Default is white.

   -b col Set the background (window) color. Default is black.

   -s col Set the text shadow color. Default is black.

          Colors can be a hex RGB value, e.g.  -f 00ff00  (green)

          or one of the standard NSColor names: black, darkGray, lightGray, white,

                        gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown.

   -o alpha  

          Set the transparency of the window. default is 0.640.

          0 is fully transparent, 1 is fully opaque.

   -d     detach and run in the background

   -H     Honk.

   -      read text from standard in, rather than arguments.

   --help Print this help message.

Text, including multi-line text, will be shrunk as needed to fit.