RV: stsh (was: Scripting languages and IDEs)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

RV: stsh (was: Scripting languages and IDEs)

Edgar J. De Cleene
Aca hay otra cosa muy interesante.
En algún SqueakLight tengo andando AppleScript para que me "enganche" el
resto del sistema y anda bien.
Esto parece mejor.
A pesar de gustarme Squeak, no soy fundamentalista y si se pueden usar las
capas inferiores del OS X, encantado.


------ Mensaje reenviado
De: Marcel Weiher <[hidden email]>
Responder a: The general-purpose Squeak developers list
<[hidden email]>
Fecha: Fri, 25 Aug 2006 11:42:23 +0200
Para: The general-purpose Squeak developers list
<[hidden email]>
Asunto: stsh (was: Scripting languages and IDEs)


On Aug 24, 2006, at 21:39 , Damien Pollet wrote:

> On 8/24/06, Marcel Weiher <[hidden email]> wrote:
>> Interesting discussion, as I have been wrestling with this very issue
>> in my Objective-Smalltalk / stsh work for some time now.
>
> can we play with stsh ? besides systrace shell google only found a
> mail from you :)

As it happens, I created an internal 'release' package the other day
just before I stumbled on this thread.  The package can be found at:

 http://www.metaobject.com/downloads/Misc/stsh.tgz

This is not even a pre-release, binary only, only runs on Mac OS X
(Tiger) and also comes with not documentation whatsoever, not even a
Readme!  That said, I have been using it myself and it has proven
quite useful.

Contents of the tar are a couple of frameworks that need to be put in
a frameworks place ( /Library/Frameworks/ or ~/Library/Frameworks/ )
and the stsh executable itself, which is probably best place in /usr/
local/bin/ .

As Smalltalkers, you will probably miss the Smalltalk class
libraries:  they aren't there.  It's Objective-C and Cocoa underneath.

So it's NSArrays, NSStrings, and NSDictionaries, as well as those
protocols:

 > 'Hello World' class.
NSCFString


Of course, that isn't all bad.  You have Foundation, AppKit, QTKit
(QuickTime), WebKit, CoreImage and friends to play with.

Here is an example script, it uses QuickTime to concatenate a bunch of
movies:

--------------- qtcat --------------------
#!/usr/local/bin/stsh

#---  load a framework we weren't linked against

qtkit := NSBundle bundleWithPath:'/System/Library/Frameworks/
QTKit.framework'.
qtkit load.

#---  command line parameters are passed in "args"

movieArgs := args.

#---  Objective-Smalltalk will convert a string to an Objective-C
selector (SEL)

movieArgs := movieArgs sortedArrayUsingSelector:'numericCompare:'.

#---  Higher Order Messaging works...(what did you expect?!)

movies:=QTMovie collect movieWithFile:movieArgs each error:nil.
firstMovie := movies objectAtIndex:0.
restMovies := movies subarrayWithRange:(1 to:movies count-1).

#---   we will append the rest of the movies to the first movie,
#---   so we have to make that one editable.

firstMovie setAttribute:1 forKey:'QTMovieEditableAttribute'.

#----   Movie editing in QTKit is based on selections, so we
#----   have to do a 'select all' by getting the total range
#----   and then

ranges := restMovies collect movieAttributes collect
objectForKey:'QTMovieActive
SegmentAttribute'.
0 to: restMovies count - 1 do: [ :i | (restMovies objectAtIndex:i)
setSelection:
(ranges objectAtIndex:i) ].

#----    now do the append.

firstMovie do appendSelectionFromMovie:restMovies each.

#----  figure out a good name for the result

outName := (movieArgs objectAtIndex:0) stringByDeletingPathExtension.
outName := outName stringByAppendingString:'-full.mov'.
outputAttributes := NSMutableDictionary dictionary.

#----  flattening would be nicer, because then you don't have to keep
the
#----  original files around, but sometimes doesn't work

#outputAttributes setObject:1 forKey:'QTMovieFlatten'.

#----  write the result

firstMovie writeToFile:outName withAttributes:outputAttributes.
#NSFileManager defaultManager do removeFileAtPath:movieArgs each
handler:nil.

--------------- qtcat --------------------

Flames, comments, suggestions welcome.

And yes, there will be a real release, but I want to get the native
code compilation a bit more complete than it is at the moment.

Marcel



------ Fin del mensaje reenviado



       
       
               
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas




correo electrónico a: [hidden email]


correo electrónico a: [hidden email]

 
Enlaces de Yahoo! Grupos

<*> Para visitar el sitio web del grupo, andá a:
    http://ar.groups.yahoo.com/group/squeakRos/

<*> Para cancelar tu suscripción a este grupo, enviá un mensaje a:
    [hidden email]

<*> El uso de Yahoo! Grupos está sujeto a las:
    http://ar.docs.yahoo.com/info/utos.html