Re: Pop up window ala msn messenger
Re: Pop up window ala msn messenger
- Subject: Re: Pop up window ala msn messenger
- From: John Stiles <email@hidden>
- Date: Thu, 30 Mar 2006 09:29:12 -0800
Finlay Dobbie wrote:
On 30/03/06, David Chan <email@hidden> wrote:
Really appreciate all the suggestions. I have donwloaded and learned about
what growl can do. Indeed it is fantastic, Alexander. But as what Savant
said, my companies does not wish to rely on third party solution. As such, I
would have to try RTFM NSWIndow Finlay mentioned, or what Savant suggested,
the borderless window.
Borderless window at a high window level. You could always look at how
Growl accomplishes what it's doing (it's open-source), but be aware of
the licensing issues (IIRC it's GPL).
You might consider using Growl if it's available, and rendering your own
window if it's not.
I was recently inspired by this thread and decided to take a look at
Growl. My first reaction was: "I have to add a 140K framework to my app?
Forget it." After a little more research I found Growl also supports
AppleScript--and even better, the AppleScript method doesn't require a
special framework. You just need to tell "GrowlHelperApp" to show the
message. So a few minutes later with NSAppleScript, I had the problem
90% solved. A few /hours/ later, I got that last 10% ;)
What was the last 10%, you ask? Foreign language strings. AppleScript
doesn't allow you to do this:
set myMessage to "????"
At script-compile time, the text turns into mojibake. Try it in Script
Editor some time :) You have to do this:
set myMessage to («datautf8DEADBEEF1234» as Unicode Text)
Replacing the "DEADBEEF1234" part with real UTF8 data. This technique
took a long time to find as it's not very well documented at all.
My opinion is that AppleScript desperately needs a bit of modernization
in the Unicode department; newbies who don't speak English will never
figure out how to do something like that with Script Editor. Looking at
past OS release notes, it's obvious that the AppleScript team has been
working on the Unicode aspect already, but it's still relying on
MacRoman in some places, unfortunately.
Anyway, other than that hiccup, it's dead simple to tell Growl to show a
message. And there are some serious advantages to this approach:
- Theoretically, if the framework has a bug, your app might crash. Not
saying that it does, but it's always something to consider. I am pretty
convinced that Apple Events are robust, though :) If the AppleEvent
manager has trouble sending the message to GrowlHelperApp, it probably
won't take down your app.
- Your app footprint saves 140K.
- Sending the AppleEvent really isn't that much more code anyway. If it
wasn't for the UTF8 issue, it would almost be a tossup.
PS Make sure to check that "GrowlHelperApp" is already running before
trying to run that AppleScript! Use the Carbon Process Manager to do
this; Cocoa's "launchedApplications" method doesn't work for faceless apps.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden