Monday, July 27, 2009

Supporting AppleScript in a Cocoa Document-Based App

It seemed like it should be easy, and it was, but finding out how was hard. So I am posting what I did here in the hope that the next person wanting to do it finds the info they need here.

What I wanted to do


I had a Cocoa document-based app. I.e. I had followed my nose with Cocoa, and ended up with an app that supported multiple documents. Documents are represented by in subclass of NSDocument called MyDocument.

I wanted to support viewing and changing properties of the document from AppleScript.

Note that I wanted to support 10.5+, so the techniques here may not be appropriate for older versions.

How I ended up getting it working


  1. Specify things in the app's Info.plist:
    NSAppleSriptEnabled = YES

    OSAScriptingDefinition = MyApp.sdef


  2. Made an sdef file, which includes all the framework supplied stuff, and that MyDocument extends the framework document, and has a property, refered to by the key numBananas:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd">

    <!-- declare the namespace for using XInclude so we can include the standard suite -->
    <dictionary xmlns:xi="http://www.w3.org/2003/XInclude">

    <!-- use XInclude to include the standard suite -->
    <xi:include href="file:///System/Library/ScriptingDefinitions/CocoaStandard.sdef" xpointer="xpointer(/dictionary/suite)"/>

    <suite name="MyApp Suite" code="LfMS" description="MyApp application specific scripting facilities.">

    <class-extension extends="document" code="docu">
    <cocoa class="MyDocument"/>
    <property name="number of bananas" code="Bana" type="integer" access="rw" description="The number of bananas in this document" >
    <cocoa key="numBananas"/>
    </property>
    </class-extension>

    </suite>

    </dictionary>

  3. Implement KVC accessors for the property. These looked (sortof) like:
    -(NSNumber*)numBananas
    {
    return [NSNumber numberWithInt:bananas];
    }

    -(void)setNumBananas:(NSNumber*)value
    {
    bananas = [value intValue];
    }



This was all that it took, and now I can enumerate all the docs, set their number of channels etc etc.

Apologies to all my regular readers if this is slightly outside your sphere of interest!

Monday, July 20, 2009

Beats Traash Aural Reality 18th July 2009

Beats Reality Radio runs every Saturday 7-9 pm. Tune in to 91FM in the Dunedin area, or get the stream online from Radio 1. Haszari, SoNic Smith and guests play plenty of fresh banging fidget, wobble, electro, breaks, house, tech house, and a lot of other stuff.

The show is podcast every week: get it from http://feeds2.feedburner.com/beatsreality. You can subscribe with ease from there. Or just search iTunes store for "energyflash" or "haszari" - free to download/subscribe.

Azymuth & Mark Pritchard - Pieces of Ipanema (Mark Pritchard remix)
The Bulgarian ft. Spoek - Crazy Dog Biscuit (Kink remix)
Hijack - Keep It Real
Devil's Gun - Gold Dust (Boy 8-Bit remix)
Silicone Soul - The Pulse
Dem Slackers - God Is A Slacker (Lee Mortimer remix)
Jesse Rose - Touch My Horn (Mad Kids remix)
Mr Pher - Karma Baby
Digital Manges - Give Me A Reason (Douster remix)
Freeland - Under Control (Alex Metric remix)
Luger Boa - I Need A Girlfriend (Greg Churchill remix)
Angela Fisken - Trash Test
Greg Churchill - Bubblegap
Will Bailey - The Dutty Clem (The Bulgarian mix)
Para-Beats - Hear Diss
Aquasky & Tee Ski - Back To The Top
Aniki - Evil Nugget (Koochie's Bass mix)
SoNic Smith - Ladies Style (Haszari's Le Mans Style remix)
Moby - I Love To Move In Here (Proxy remix)
Bass Weazal - Weazals Love Reggae (Lee Mortimer remix)
Bloc Party - One More Chance (Alex Metric remix)
The Bloody Beetroots - Warp 1.9
Clazziquai Project - Prayers (Shinichi Osawa remix)
The Timelords - Doctorin The Tardis (Dada Life Guerilla Fart #8)

(post originally appeared on http://haszaristwocents.blogspot.com/)

Wednesday, July 1, 2009

Cartoon Beats scores #1 with the first release! (and is available on iTunes)

Yep - SoNic Smith's Ladies Style (Haszari's Le Mans Style remix) is number 1 on Dunedin's Radio 1 Top 11!

So huge thanks to everyone who voted, this is quite unexpected and we really appreciate it.

How far can we take this story? Well if you're elsewhere around the country, or just feel like voting, you can vote for us at any of the bNet/independent stations:
Dunedin / Radio 1:
http://www.r1.co.nz/top11.php
Auck / bfm:
http://95bfm.com/default,top10.sm
Christchurch / RDU:
http://www.rdu.org.nz/music.html
Wellington / Radio Active:
http://www.radioactive.co.nz
Palmy / Radio Control:
http://www.radiocontrol.org.nz/page.php?9
Auck / George:
http://georgefm.co.nz/
Hamilton / Contact:
http://www.contactfm.co.nz/

If you want a piece of the action, you can now buy the EP (or individual tracks) direct from iTunes. So get yours! And.. if you want a freebie, sign up to the mailing list at Cartoon Beats. We'll be sending out regular mailings with news and free exclusive tracks, edits & mixes.

And again, thanks to everyone who's helped us get this far - DJs who played the tracks & demos, wives/partners, radio stations who played our stuff, Radio 1, Rob Vouchermate, people who voted, people who've come see us play... etc. Too many names to list. Thanks!

CBR001 Cover Art
SoNic Smith & Haszari - Cartoon Beats - Ladies Style - the JAcket

Saturday, May 23, 2009

Beats Reality Radio NZ Special Beats 23 May 2009

Cheers SoNic & Booooof, what a great show, what a great country (NZ).

Beats Reality Radio runs every Saturday 7-9 pm. Tune in to 91FM in the Dunedin area, or get the stream online from Radio 1. Haszari, SoNic Smith and guests play plenty of fresh banging fidget, wobble, electro, breaks, house, tech house, and a lot of other stuff.

The show is podcast every week: get it from http://feeds2.feedburner.com/beatsreality. You can subscribe with ease from there. Or just search iTunes store for "energyflash" or "haszari" - free to download/subscribe.

Tracklist:
Home Brew - Wednesday
Stray Theories - Red Squares (Drift mix)
Cusp - Tic Tac Toe
Kora - Burning (Dan Aux Shopliftas mix)
Fiord - Karmikloops (??)
Magik Johnson - Straight Face
Greg Churchill - Babblegap
Flek C - Turn Down The Suck
Antiform - Grip ft. Ethical & Neesh
Smashproof - Brother (Sample Gee & General Lee Unbreakable mix)
Ladyhawke - My Delirium (Pitch Dark remix)
Deepchild - Fractures (Fiord mix)
Tim Richards - Pick N Roll
nsu - Concordia
Emerson Todd - Rumplestiltskin
N.A.M.E. - N.A.M.E.less
Module - The Chop Shop
Ladyhawke - My Delirium (Toddla T & Ross Orton remix)
Pig Out - Untitled Breakbeat 2

Friday, May 22, 2009

Beats Reality Radio ft. Dan Aux all the way down from Aucks (NOT Aus)

Cheers to Dan Aux of Shopliftas fame for shootin' the breeze with us. He's got a new track Disko out on Ground Level Breaks.

Here's a DJDownload player chock full of Shopliftas back catalogue - buy these tracks!

Buy & download dance music from djdownload.com

Royksopp - The Girl & The Robot (Chateau Marmont remix)
Jesse Rose - You're All Over My Head
Yea Yea Yeahs - Zero (RAC remix)
Will Bailey - The Dutty Clem (The Bulgarian remix)
The Incredible Melting Man - Gangsta Filth (Wongo remix)
2 Bit Thugs - Tearing Up The Club (Kelevra's Pink But Perky remix)
Nagano Kitchen - GSXR 810
The Bulgarian ft. Spoek - Crazy Dog Biscuit (2 Bit Thugs remix)
Southside House Collective - Southside Goes Wicked
Pomomofo - Back At The Club (Boy 8-Bit remix)
Herve - (I Can) Get Down
Baobinga & ID pres. Big Monster - Jewelz
Metric - War On Diamonds (Ajax remix)
Audio Bullys - ft. Nancy Sinatra - Shot Me Down
fRew & The Shopliftas - Bermuda Nights
Shopliftas - Disko
La Roux - In For the Kill (Dan Aux ADSR remix)
Tee Ski & Shab Ruffcut - Jacket Potato House

Beats Reality Radio runs every Saturday 7-9 pm. Tune in to 91FM in the Dunedin area, or get the stream online from Radio 1. Haszari, SoNic Smith and guests play plenty of fresh banging fidget, wobble, electro, breaks, house, tech house, and a lot of other stuff.

The show is podcast every week: get it from http://feeds2.feedburner.com/beatsreality. You can subscribe with ease from there. Or just search iTunes store for "energyflash" or "haszari" - free to download/subscribe.

Next week (aka tomorrow, been a busy week!) all NZ material for NZ music week, so tune in...

Saturday, May 9, 2009

Beats Reality Kelevra & Fidget House is Special 9th April 2009

Julian Jabre - Vicious Circle (John Dahlback dub)
Daft Punk - One More Time (Sebastien Leger bootleg)
Cops & Robbers - Maximilian
Lee Mortimer - Where The Party At (Totally Enormous Extinct Dinosaurs Nanotyrranus mix)
Pig & Dan - Heat
The Incredible Melting Man - Gangsta Filth (Dylan Holshausen mix)
Mightyfools - Amsterdam (ft. Guerilla Speakerz) (Dem Slackers remix)
2 Bit Thugs - Tearing Up The Club
Aniki - Dope Girl (original mix)
Menck & Lissat - Attitude (Kelevra's Freaky remix)
Audio Slingers ft. Lesley Williams - Radio Noise (Kelevra's Jacked Up remix)
Will Bailey - The Dutty Clem (Aniki's Will Loves The Bass mix)
Beep - Pastafari (Kelevra remix)
Kelevra - Love You So (ft. Kop Out) (Mightyfools remix)
The Bulgarian ft. Spoek - Crazy Dog Biscuit (Kink remix)
Aquilaganja & Steff Smith - The Wobble (Torvill & Dean Old Skool mix)
Jak-Z - Get Your Ass Up (Kelevra remix)
Tee' Ski & Shab Ruffcut - Jack Da Ripper (Lee Mortimer remix)
Armand Van Helden - Illin It & Fillin It (Lee Mortimer's Wearhouse Music mix)
Dem Slackers - The Joker (Edu K's Bad Boy Stomp remix ft. MC GI Lee Mortimer)
Jaimie Fanatic & Jesse Voorn - Radio Speaker

Beats Reality Radio runs every Saturday 7-9 pm. Tune in to 91FM in the Dunedin area, or get the stream online from Radio 1. Haszari, SoNic Smith and guests play plenty of fresh banging fidget, wobble, electro, breaks, house, tech house, and a lot of other stuff.

The show is podcast every week: get it from http://feeds2.feedburner.com/beatsreality. You can subscribe with ease from there. Or just search iTunes store for "energyflash" or "haszari" - free to download/subscribe.

Friday, May 8, 2009

Some Great Fidget House Tracks

This thursday at Bath St Kelevra's playing. I'm playing too, it's going to be an amazing night, lots of good support DJs.
Event on facebook here...

Kelevra plays fidget house, i.e. hefty wobbly jackin' electro. It's the Potty Mouth Kids tour; Wongo and Adam Bozzetto (among others?) are hitting other NZ destinations. Cheers Potty Mouth!

So in celebration here's a player chock full of insane fidget house tracks that I am currently into.

Get Your Own Viral PlayerGet These Tracks

Buy & download dance music from djdownload.com

Yep, listen in the player, click the link to buy, this stuff is all gold people.

(not "gold people", gold tracks, people)