Go Down

Topic: OS X: arduino + adium and gmail (Read 955 times) previous topic - next topic

melka

Here's a processing sketch that polls adium using the applescript you gave earlier.
It returns an integer.
Nobody never talks to me, so I always get 0, but it should work ^^

Code: [Select]

import com.apple.cocoa.foundation.*;

void setup() {
 size(400,400);
 int adiumUnread = runAS();
 println(adiumUnread);
}

void draw() {
 
}

public int runAS() {
 String script = "tell application \"Adium\"\n"
 +"  set x to 0\n"
 +"    repeat with theChat in (every chat)\n"
 +"    set x to x + (unread message count of theChat)\n"
 +"    end repeat\n"
 +"  end tell\n"
 +"  x";
 NSAppleScript myScript = new NSAppleScript(script);
 NSMutableDictionary errors = new NSMutableDictionary();
 NSAppleEventDescriptor result = myScript.execute(errors);
 return result.int32Value();
}

Mexduino

#6
Feb 21, 2009, 08:29 pm Last Edit: Feb 21, 2009, 08:34 pm by formatc1702 Reason: 1
hi!

thanks for that. however, it says it can't find the package com.apple.cocoa

where can i find it, and how can i make processing see it? i am already using javax.mail and i just had to copy it to the /code folder inside my sketch folder.

[size=20][ch12377][ch12372][ch12356][ch65281][/size]

melka

Sorry, I forgot about that.
The package is already present on macosx systems, but a bit find to hard.
Here's the way to have it working

http://processing.org/discourse/yabb_beta/YaBB.cgi?board=LibraryProblems;action=display;num=1225564736

Mexduino

wonderful! it works perfectly! e-mail and adium notifications on the arduino!

thanks a lot for all the help... i'm slowly getting into processing after all! (and a bit of applescript on the way)

[size=20][ch12377][ch12372][ch12356][ch65281][/size]


Go Up