Applescript in Leopard

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

Applescript in Leopard

Javier Diaz-Reinoso
I tested the Squeak front-end to Applescript in Mac OSX 10.5, using
Squeak3.9-final-7067 and is working OK.

Because AppleScript 2.0 (included with 10.5) is "now entirely Unicode-
based" according to Apple, some statements with unicode strings work  
now, such as:

> ba := #(0 16r22 0 16r28 16r5B 16r5D 16r7D 16rEC 0 16r29 0 16r22)  
> asByteArray.
> bs := ba asString.
> ws := bs convertFromWithConverter: UTF16TextConverter new.
> Applescript doIt: 'display dialog (', ws, ' as Unicode text)'

and if you select a file with unicode characters in the name:

> bs := Applescript selectAnyFile.
> Applescript doIt: 'display dialog (', bs, ' as Unicode text)'

what don't work (using Squeak 3.8.18beta1U VM) is using the clipboard,  
directly or using the 'copy name to clipboard' from the file list  
browser, probably the VM need some modifications.




Reply | Threaded
Open this post in threaded view
|

Re: Applescript in Leopard

johnmci
Please look into the Extended Clipboard support we have in Sophie.
It lets you move data (utf8,utf16,unicode) and images (TIFF,etc)  
between Squeak and your Smalltalk Code.
On the macintosh there is a plugin, but on windows we use FFI.


On Dec 9, 2007, at 1:18 PM, Javier Diaz-Reinoso wrote:

> I tested the Squeak front-end to Applescript in Mac OSX 10.5, using
> Squeak3.9-final-7067 and is working OK.
>
> Because AppleScript 2.0 (included with 10.5) is "now entirely  
> Unicode-based" according to Apple, some statements with unicode  
> strings work now, such as:
>
>> ba := #(0 16r22 0 16r28 16r5B 16r5D 16r7D 16rEC 0 16r29 0 16r22)  
>> asByteArray.
>> bs := ba asString.
>> ws := bs convertFromWithConverter: UTF16TextConverter new.
>> Applescript doIt: 'display dialog (', ws, ' as Unicode text)'
>
> and if you select a file with unicode characters in the name:
>
>> bs := Applescript selectAnyFile.
>> Applescript doIt: 'display dialog (', bs, ' as Unicode text)'
>
> what don't work (using Squeak 3.8.18beta1U VM) is using the  
> clipboard, directly or using the 'copy name to clipboard' from the  
> file list browser, probably the VM need some modifications.
>
>
>
>

--
=
=
=
========================================================================
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
=
=
=
========================================================================