Archive for October, 2003

October 31st, 2003

The Rise and Fall of the Script Menu

Posted in Software by Diggory

Classic

In the Mac OS there is a very useful feature called the Script Menu. It allows the user to execute AppleScripts from the Menu Bar.
It appeared first in the Classic OS and was available to the right of the application’s own menus (to the left of the universally-available “Help” menu):

It was available on a per-application basis - if the foremost application did not support the menu then it would not appear. In order to populate the menu you would place AppleScripts in an application-specific folder. e.g. for iTunes a folder called “Scripts” of the iTunes folder (Which was generally in the Applications folder.) The user could also place scripts in their Documents > iTunes folder for scripts that were available for that user only.

Classic Script Menu

Mac OS X 10.2 - Jaguar

When OS X (10.2 Jaguar) was released the Script Menu returned to the Mac OS in a much more elegant incarnation.

  • It was implemented as a Menu Extra - in the top right of the Menu Bar - like the Volume and Battery menu extras. I personally prefer this - it seemed out of place amongst text-based menus.
  • It is not limited to AppleScripts - it can also run Shell Scripts.
  • Instead of each application managing it’s own script collections in odd folders scattered all over the filesystem there was now a central repository for Menu Scripts - The “Scripts” folder of the Library.
  • Because it uses the Library it respects the “cascading” metaphor that Mac OS X inherited from NeXT - The idea that Library resources are a composite of resources from the Network , Host & User libraries. This means you can have scripts available to all users on your OS X Server network, available to all users on a specific machine (host) or just available to one user - The scale of availability depends on which Library the resource is placed in.
  • It uses the “Application Support” metaphor to allow scripts to be application-specific - if you are running an application called FOO the Script Menu will also show Scripts that are at the path Library/Scripts/Applications/FOO/ (remember that Library is any of the three available Libraries.)
Script Menu Extra

Mac OS X 10.3 - Panther - A retrograde step?

Panther Script Menu

In Panther, certain apps (DVD Player, Address Book) seem to have had amnesia - they think we’re back in OS 9. They have implemented their own, classic-style AppleScript Menu. Not only is it ugly it also interferes with the real Script Menu!

As you can see from the ScreenShot on the right these apps display an unnecssary Extra Script Menu (in an ugly place if you ask me) - but also they expect their scripts to be kept in a directory called “Foo scripts” of the “scripts” directory (replace Foo with the name of the app.)

What’s wrong with that? Well, for a start any Directories that are put in the root of the Scripts Directory are automatically listed in the real script menu - and so you end up with a horribly screwed-up Script Menu! So you quietly curse and remove the offending “Address Book Scripts” folder - and the next time you launch AddressBook it REPLACES THE DAMN DIRECTORY!

October 30th, 2003

Speak Unread Mail Summary

Posted in AppleScript by Diggory

This script will speak a summary of your unread mail in Mac OS X’s Mail application. In Panther’s Mail.app you can have an AppleScript run as part of a rule - so you can effectively have your computer announce who your mail is from and what the subjects are as it arrives - without having to even switch to the Mail app. You can also refine your rule so that the script is only executed for certain Mail Accounts, or whatever criteria you please.

tell application “Mail”
repeat with thisAccount in every account
set thisInBox to mailbox named “INBOX” of thisAccount
set thisUnreadCount to unread count of thisInBox

if thisUnreadCount is not 0 then
set unreadMessages to (messages of thisInBox whose read status is false)

if thisUnreadCount > 1 then
set pluralText to “s”
set verbText to “are”
else
set pluralText to “”
set verbText to “is”
end if
set speechCountText to “There ” & verbText & ” ” & thisUnreadCount & ” message” & pluralText & ” in ” & (name of thisAccount) & “.”
say speechCountText

repeat with i from 1 to number of items in unreadMessages
set thisMessage to item i of unreadMessages
set theSender to sender of thisMessage

set savedTextItemDelimiters to AppleScript’s text item delimiters
try
set AppleScript’s text item delimiters to {”<"}
set realName to (first text item of (theSender as string))
--finally, reset the text item delimiters:
set AppleScript's text item delimiters to savedTextItemDelimiters
on error m number n from f to t partial result p
log ("Error: " & m & number)
--also reset text item delimiters in case of an error:
set AppleScript's text item delimiters to savedTextItemDelimiters
--and resignal the error: error m number n from f to t partial result p
end try

set messageSpeechText to "From: " & realName & ". Title: " & subject of thisMessage
say messageSpeechText
end repeat
end if
end repeat

end tell

October 30th, 2003

Signed, Sealed, Encrypted - I’m Yours.

Posted in Technology by Diggory

Mail in Panther has great support for Encrypted and Signed mail.

A Signed eMail

See Here for a great article on how to implement it using a Free (email-only) Certificate from Thawtes.

n.b. when applying for your cert. don’t forget that the email address is case-sensitive - so you have to use exactly the same case for your email address in Mail.app as is in the Certificate - foo@bar.com is not equivalent to Foo@Bar.Com

n.b. You will need a fully-fledged Mozilla Browser to actually get the Cert - Mozilla Firebird won’t do.

October 29th, 2003

That’s just silly

Posted in Console Games by Diggory

G5 Head

Now that’s just silly - look at what those silly people on the Internet did

[edit]

Separated at birth? Avid Merrion - Proper Bo’ Selecta!

Avid Merrion

October 25th, 2003

Panther

Posted in Software by Diggory

Mac OS X Panther Box

Mac OS X (10.3) Panther has been released.

October 24th, 2003

Urban Myth - Ballpoints don’t work in Space

Posted in Real World by Diggory

There is a famous urban myth (I first saw it in someone’s sig. on Slashdot) that the American Space Programme spent millions on a “SpacePen” that would work in the Zero-G of space — While the Russians used Pencils.

This isn’t true for a variety of reasons-

  • NASA did not commission the SpacePen that we all saw advertised in the 80’s - You know - the one that can write underwater. It was developed by some loony just because he wanted to.
  • The Russians used ordinary ballpoints - that work fine in Zero-G
October 24th, 2003

Farewell Concorde

Posted in Zeitgeist by Diggory

concorde
Concorde has her last flight today.

So why not send her off with your own blade-runner style tribute.

October 22nd, 2003

Note To Self - Conditional Logging

Posted in Coding / Development by Diggory

Some times when developing an application it makes life easy if your code spits out information to the console using NSLog. This is known as CaveMan debugging :)

You don’t want end users to have to endure console Tourettes though, and commenting out the logging statements every time you build for distribution would be a little annoying. What to do?

Here’s a way to have logging statements that don’t appear in release code.

In Project Builder you have different Build Styles for Targets. These Build Styles contain Build Settings that affect the how the Product (your application) is built. The Build Settings add to, or override, the Target’s Build Settings.

With every new Project in Project Builder there are two default Build Styles.
Development
Development Build Style
and Deployment.
Deployment Build Style

When you build with the Deployment style the final product will be smaller in file size, but harder to debug. This is because this build style asks the compiler to strip out debugging symbols and optimise the code.

We are going to add a new Build Setting to the Development Style:

OTHER_CFLAGS = -D_DEBUG_

The OTHER_CFLAGS key is described in The Project Builder Build Settings Documentation:

“This setting defines flags passed to the compiler for all C and ObjectiveC compiles. This flag can be used cases where there is no other build setting for a particular feature.”

The Value for this build setting: -D_DEBUG_ is the flag we are passing to the compiler (GCC)

man gcc tells us that the -D switch defines a macro with a value of 1. The macro name we have chosen is _DEBUG_

So what the build setting does is define a macro so that whenever _DEBUG_ is found in the source the pre-processor will substitute 1. (And of course this only applies to the Development Build Style.)

Now we can put statements like this into our code:

#if _DEBUG_

NSLog(@”awakingFromNib”);

#endif

So - if we are building with the Development Style - the Logging line gets compiled in also.

Cool.

October 22nd, 2003

note to self - App Name Formats

Posted in Coding / Development by Diggory

[this entry is a note to myself - I always forget which way round these are]

?Display name? is the short name for this bundle; for example, ?Sketch.? It should contain only one or two words and a maximum of 16 characters. For an application, this is the name of the first menu in the menu bar. It corresponds to CFBundleName. By default, the field is empty.

?Short version? is the bundle?s full name and version number; for example, ?Apple Sketch 1.1.0.? By default, the field is empty.

?Get-Info string? is any information you want to appear in the Finder?s Info window. Generally, it?s the bundle?s full name, version number, and copyright information. For example, ?Apple Sketch 1.1.0; Copyright ©2001, Apple Computer Inc.? It corresponds to CFGetInfoString. By default, the field is empty.

October 22nd, 2003

Nice Timing

Posted in Hardware by Diggory

October 2003 model iBook laptop
It seems it’s true - G4 ibooks

October 22nd, 2003

New iBooks on horizon?

Posted in Hardware by Diggory

According to This page we could be seeing G4 iBooks today. Of course any Mac rumour has to be taken with a pyramid of salt - but it’s not inconceivable - The iBook is next on the update cycle - we’ve had new Powerbooks, the G5, new iPods and a new iMac since the iBook went 14″ this Spring.

Plus the Apple Store is currently down (a seemingly import augur for mac-soothsayers.)

Or maybe it’s just broken because everyone’s trying to check to see if their Panther order has shipped ;)

October 21st, 2003

Halo for Mac Release Date

Posted in Console Games by Diggory
Halo for Mac finally has a release date (3rd December 2003). Originally it was a Mac game - it was shown at MacWorld 1999. Then the the evil Microsoft bought Bungie to support their hideous XBox. (They did the same thing with Rare.)

Technically this shouldn’t be in the Console Games category - but I usually use my Mac for work and my PS2/GameCube for games - and I don’t think we’ll see Halo for PS2 any time soon ;) )

Halo Screenshot
October 21st, 2003

SSX3

Posted in Console Games by Diggory
ssx3 screenshot I’m really looking forward to SSX3 on the PS2. The first two were great and this review implies that this version is even better. Hopefully the network play element will be intact when it is released in the UK.
October 21st, 2003

P900

Posted in Hardware by Diggory
p900 Well - SonyEricsson have finally released the p900 - my p800 is now officially yesterday’s bulky phone ;) For a good comparison to the p800 and a list of nice improvements see here sony ericsson p800
October 20th, 2003

Services in the Contextual Menu

Posted in Software by Diggory

In Mac OS X the Services menu is hidden away up in the Application Menu - miles from the data it is working on. Since the Services are context-sensitive it seems natural that it should be available from the Contextual Menu (the one that appears when you right-click (or control-click)).

I always wondered why Apple hasn’t done this - I used to have a pet theory that someone high-up at Apple disliked it. Now I know the real reason:

This page explains it:

Eric Schlegel of Apple says:
“We’re aware of this issue and I agree it would be a useful thing to do. The tricky part is that the Carbon implementation of Services requires that a Carbon event be sent to an event target representing the object to which the service would be apply. When a contextual menu is opened, there is no event target passed to the Contextual Menu Manager to indicate the object to which the menu applies; therefore, the Services support in Carbon has no where to send its Carbon events.
I’ve got some ideas for new Contextual Menu Manager APIs that would take an event target so we could solve this in the future, but it will probably require application adoption.”

October 20th, 2003

Cordless Phones

Posted in Hardware by Diggory

I went home at the weekend and noticed that my mother had bought a new cordless DECT phone. The interesting thing about this phone was that it could send SMS text messages. (for a similar, but not identical phone see here)

About three years ago I had the same idea I was wondering if anyone would ever implement it. I think it’s cool that they have.

Now we just need the DECT handset manufacturers to realise that Bluetooth (or TCP/IP over Ethernet) and SyncML would be good features in a cordless phone. Then you could sync your house phone with you central Contacts Database (usually an Address Book application on a Personal Computer - but could be on the net.)

Remember kids - Open Standards and Interoperability are good
Re-inventing the wheel and proprietary systems are bad.

October 19th, 2003

TaggingService

Posted in Software by Diggory

I have just posted my Tagging Service.

I have been trying to do something like this for a while now - but was trying to make it too GUI based - which allows more options, but was a nightmare because of the way that Services get invoked.

The way it works now is more Service-like - the tag that gets applied to the text is dependant on the format of the text to be tagged:

for example:
foo:bar becomes <foo>bar</foo>

October 17th, 2003

iTunes

Posted in Software by Diggory
iTunes Tom’s Blog notes wisely that iTunes is now available for Windows - If you use Windows (not 98 or ME) give it a go - You’ll like it (and it’s free.)

[edit] - well it looks like it’s quite popular