Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I know that I can define a new iCal event programmatically, by means of AppleScript, defining something like:

 tell application "iCal"
    tell calendar "My Calendar"
        set theCurrentDate to current date
        set newEvent to make new event at end with properties {description:"Test Event Description", summary:"Test Event", location:"Foo Location", start date:date "21/5/2012", end date:date "23/5/2012", allday event:true}
        tell newEvent
            make new sound alarm at end with properties {trigger date: date "21/5/2012 09:00", sound name:"Glass"}
        end tell
    end tell
 end tell

However, I'm not really happy with having to say a precise date in 'trigger date', I'd prefer to be able to specify 'the same day at 9:00' or '2 hours before'. This is is possible via the GUI, but I cannot find the corresponding AppleScript syntax. Is there a reference for this sort of things?

Thank you in advance.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

If you are referring to the natural language input box Lion’s iCal pops up when you click the + button, that functionality does not seem to be exposed to AppleScript.

The reference for this, in fact the first reference for the scripting model of any application, is its own own scripting dictionary – the documented scripting interface you can browse in the Library window of AppleScript editor. iCal’s is in there by default, as is the dictionary of most scriptable applications that come pre-installed with OS X, but you can add any scriptable app by just dropping it on the window (or going the long route through the + button) – it’s a good way to find out if an app is scriptable, BTW, as non-scriptable ones will just refuse to add themselves to the Library.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.