MacOS X interface to core frameworks

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

MacOS X interface to core frameworks

Andre Schnoor
Hi all,

I'm currently finetuning a rather complex application (http://www.cognitone.com/products/mps/intro/page.stml?nc=1) and optimizing it for the MacOS X environment. Unfortunately I'm having a hard time implementing a number of rather basic functions which are not supported by the VM:

- Get current locale (i.e. user language, the VM primitive doesn't seem to work)
- Get current user name and home directory
- Launch browser or mail application for a given URL (visit website from menu)
- Launch applications for a given filename (open PDF user manual from menu)
- etc.

The principles of interfacing Apple frameworks through DLLCC are not a problem for me (already sucessfully implemented a real-time multimedia engine as a framework and using it for this app). I thought, however, it was a good idea to not reinvent the wheel and ask the community whether there are existing approaches to start from.

* Does anybody perhaps know of a template for a subclass of ExternalInterface that can be extended to fulfill the above requirements? I did not find such thing in the public repository.

* Has anyone implemented the behavior of the global Mac menu bar for OS X?

* Where is a good place to accumulate and share all things Mac? I mean, before it is mature enough to be published in the repository.

Thanks in advance,
Andre



Reply | Threaded
Open this post in threaded view
|

Re: MacOS X interface to core frameworks

Reinout Heeck

On Oct 24, 2006, at 2:20 PM, Andre Schnoor wrote:

Hi all,

I'm currently finetuning a rather complex application (http://www.cognitone.com/products/mps/intro/page.stml?nc=1) and optimizing it for the MacOS X environment. Unfortunately I'm having a hard time implementing a number of rather basic functions which are not supported by the VM:


Some workarounds:

- Get current locale (i.e. user language, the VM primitive doesn't seem to work)

UnixProcess cshOne: 'locale'



- Get current user name and home directory

CEnvironment getenv: 'USER'

CEnvironment getenv: 'HOME'


- Launch browser or mail application for a given URL (visit website from menu)

UnixProcess cshOne: 'open http://www.cincomsmalltalk.com'


- Launch applications for a given filename (open PDF user manual from menu)

UnixProcess cshOne: 'open ''/Library/Documentation/User Guides And Information/Mac mini Users Guide.pdf'''




* Where is a good place to accumulate and share all things Mac? I mean, before it is mature enough to be published in the repository.


Publish into the repository please, use the blessing levels to indicate maturity.

It is silly *not* to use public versioned storage for this kind of growing thing..


Create a mac-specific 'cool things in the open repository' page on the Cincom wiki.



HTH,

R
-


Reply | Threaded
Open this post in threaded view
|

Re: MacOS X interface to core frameworks

Reinout Heeck
In reply to this post by Andre Schnoor


I forgot to include a workaround for sending mail:

UnixProcess cshOne: 'open ''mailto:[hidden email]?subject=Crash%
20Report&body=a%3d0%0d%0ab%3d42'''


R
-

Reply | Threaded
Open this post in threaded view
|

Re: MacOS X interface to core frameworks

Mark Pirogovsky-3
Reinout,

The mailto: protocol is available on both PC and Unix variants, so one
can use it on almost all supported platforms.  However in general the
command size for the mailto: is limited somewhere in the area of 2000 bytes.

Is there other way to send e-mail of arbitrary size, not only short
messages ?

On windows it is possible to use some of the MAPI protocols, but that
usually require fair amount of work via the DLLCC.

--Mark

Reinout Heeck wrote:

>
>
> I forgot to include a workaround for sending mail:
>
> UnixProcess cshOne: 'open ''mailto:[hidden email]?subject=Crash%
> 20Report&body=a%3d0%0d%0ab%3d42'''
>
>
> R
> -
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: MacOS X interface to core frameworks

Karsten Kusche
hi,

If you use the 'open' command this will only work on Mac OS X and if i
remember correctly it will also work with huge mails.

Karsten



Mark Pirogovsky wrote:

> Reinout,
>
> The mailto: protocol is available on both PC and Unix variants, so one
> can use it on almost all supported platforms.  However in general the
> command size for the mailto: is limited somewhere in the area of 2000
> bytes.
>
> Is there other way to send e-mail of arbitrary size, not only short
> messages ?
>
> On windows it is possible to use some of the MAPI protocols, but that
> usually require fair amount of work via the DLLCC.
>
> --Mark
>
> Reinout Heeck wrote:
>>
>>
>> I forgot to include a workaround for sending mail:
>>
>> UnixProcess cshOne: 'open ''mailto:[hidden email]?subject=Crash%
>> 20Report&body=a%3d0%0d%0ab%3d42'''
>>
>>
>> R
>> -
>>
>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: MacOS X interface to core frameworks

Andre Schnoor
In reply to this post by Reinout Heeck
Thanks Reinout,

your straight and simple workarounds will do it for a while.

The locale shell command however, doesn't deliver the correct settings.
Which is probably also the reason why the VM primitive doesn't do
either. It seems the terminal shell always runs in generic "C" mode.

The Wiki page for MacOS X solutions in progress is a good idea. The new
Intel Mac (and OSX in general) currently gets more and more momentum and
deserves better support. With a little help from the community, we could
perhaps aggregate essential things like native file and print dialogs,
the Mac menu bar, etc etc. I'm willing to put some effort into that.

Andre

Reply | Threaded
Open this post in threaded view
|

Re: MacOS X interface to core frameworks

Reinout Heeck
In reply to this post by Mark Pirogovsky-3

On Oct 24, 2006, at 3:58 PM, Mark Pirogovsky wrote:

> Reinout,
>
> The mailto: protocol is available on both PC and Unix variants, so  
> one can use it on almost all supported platforms.  However in  
> general the command size for the mailto: is limited somewhere in  
> the area of 2000 bytes.

Not 'in general' but 'on MsWindows', apparently this is a limitation  
of Internet Explorer:
http://support.microsoft.com/kb/208427



I experimented with it on my Mac and to my surprise the shell is the  
limiting factor, complaining about 'word too long'.

So instead I tried:

UnixProcess
     forkJob: 'open'
     arguments: (Array with: (
         'mailto:[hidden email]?subject=Crash%20Report&body='
            , (String new: 255*1024 withAll: $a)
            , '%20the%20end')).


Which works, changing the 255 to 256 makes it fail, so it seems that  
with this scheme you are limited to a maximum URL size of 256k (and a  
maximum body size depending on how many characters you need to url-
encode).



R
-



>
> Is there other way to send e-mail of arbitrary size, not only short  
> messages ?
>
> On windows it is possible to use some of the MAPI protocols, but  
> that usually require fair amount of work via the DLLCC.
>
> --Mark
>
> Reinout Heeck wrote:
>> I forgot to include a workaround for sending mail:
>> UnixProcess cshOne: 'open ''mailto:[hidden email]?subject=Crash%  
>> 20Report&body=a%3d0%0d%0ab%3d42'''
>> R
>> -
>
>

Reply | Threaded
Open this post in threaded view
|

Re: MacOS X interface to core frameworks

Alan Knight-2
In reply to this post by Andre Schnoor
As I recall, the Mac isn't using the normal Unix locale information, but has its own information stored elsehwere.

At 10:32 AM 10/24/2006, Andre Schnoor wrote:
Thanks Reinout,

your straight and simple workarounds will do it for a while.

The locale shell command however, doesn't deliver the correct settings. Which is probably also the reason why the VM primitive doesn't do either. It seems the terminal shell always runs in generic "C" mode.

The Wiki page for MacOS X solutions in progress is a good idea. The new Intel Mac (and OSX in general) currently gets more and more momentum and deserves better support. With a little help from the community, we could perhaps aggregate essential things like native file and print dialogs, the Mac menu bar, etc etc. I'm willing to put some effort into that.

Andre

--
Alan Knight [|], Cincom Smalltalk Development

"The Static Typing Philosophy: Make it fast. Make it right. Make it run." - Niall Ross
Reply | Threaded
Open this post in threaded view
|

Re: MacOS X interface to core frameworks

tblanchard
In reply to this post by Andre Schnoor
Try: defaults read NSGlobalDomain AppleLocale


On Oct 24, 2006, at 7:32 AM, Andre Schnoor wrote:

> Thanks Reinout,
>
> your straight and simple workarounds will do it for a while.
>
> The locale shell command however, doesn't deliver the correct  
> settings. Which is probably also the reason why the VM primitive  
> doesn't do either. It seems the terminal shell always runs in  
> generic "C" mode.
>
> The Wiki page for MacOS X solutions in progress is a good idea. The  
> new Intel Mac (and OSX in general) currently gets more and more  
> momentum and deserves better support. With a little help from the  
> community, we could perhaps aggregate essential things like native  
> file and print dialogs, the Mac menu bar, etc etc. I'm willing to  
> put some effort into that.
>
> Andre
>

Reply | Threaded
Open this post in threaded view
|

Re: MacOS X interface to core frameworks

Andre Schnoor
Thanks Todd, it really works:

    MacOSXSystemSupport new
       getVariable: 'AppleLocale' ifAbsent:[ 'en' ]

Cheers,
Andre


Todd Blanchard wrote:

> Try: defaults read NSGlobalDomain AppleLocale
>
>
> On Oct 24, 2006, at 7:32 AM, Andre Schnoor wrote:
>
>> Thanks Reinout,
>>
>> your straight and simple workarounds will do it for a while.
>>
>> The locale shell command however, doesn't deliver the correct
>> settings. Which is probably also the reason why the VM primitive
>> doesn't do either. It seems the terminal shell always runs in generic
>> "C" mode.
>>
>> The Wiki page for MacOS X solutions in progress is a good idea. The
>> new Intel Mac (and OSX in general) currently gets more and more
>> momentum and deserves better support. With a little help from the
>> community, we could perhaps aggregate essential things like native
>> file and print dialogs, the Mac menu bar, etc etc. I'm willing to put
>> some effort into that.
>>
>> Andre
>>
>
>