Showing posts with label applescript. Show all posts
Showing posts with label applescript. Show all posts

Tuesday, July 31, 2007

Send

You can now send messages to other people using applescript. Here's a remarkably useful script:

tell app "Adium"
if not exists chats whose contacts contain contact "applmak" then
make new chat with contacts {contact "applmak"} with new chat window
end
tell first chat whose contacts contain contact "applmak"
send message "Hi, Matt!"
end
end

Sunday, July 22, 2007

Not dead...

Just not very good at regular writings. Journals and the like.

I've updated Adium to get rid of this nasty bug that occurs when you tried to close a window programmatically. As it turns out, it's very possible that something in addTabItem (in AIMessageWindow(Controller?) is broken. The delegate isn't getting the required message. A [self _reloadContainedChats] did the trick, but it's just a quick fix, and not a real solution to the problem.

Monday, July 16, 2007

make new chat with new chat window

With help from boredzo, I just added the ability to create chats, without that nasty security hole of before.

Code Reviews

I had my first code review with Adium. Wow! It was a killer. I, in one moment, realized both how amazingly useful and powerful reviews are, and yet how incredibly embarassing they can be.

Oh well. It's a learning experience, right? 

Monday, July 9, 2007

AppleScript Unit Testing Framework

I've written a basic unit testing framework, written entirely in AppleScript, in order to test those unit tests I've been generating for Adium. It's so simple that it hardly merits mentioning, but it's just so useful. I'll see if I can figure out a way to put in online so others can dissect it.

Friday, July 6, 2007

Contacts

You can make new chats, along with chat windows. This is a very good things, and I'm really happy that I've finally done it!

Next up, running the unit tests...

Tuesday, June 26, 2007

Plan for today...

• Figure out if it's worth trying to override performDefaultImplementation for AICreateCommand to try to get rid of that stupid default alloc'ing behavior.

Yes, it is. The trick is to use a private API method to get the implementing class name. Here's the final code block (edit: while the previous code was nice, the new code is actually useful):

- (id)performDefaultImplementation
{
#warning This uses a Private API
NSScriptClassDescription *newObjectDescription = [self createClassDescription];
Class createdClass = NSClassFromString([newObjectDescription implementationClassName]);

id target = [self subjectsSpecifier]; //handy method from Dustin Voss on applescript-implementors

id r;
if ([target respondsToSelector:@selector(makeScriptingObjectOfClass:withParameters:)])
{
//this can do the insert, based on the parameters, methinks.
r = [target makeScriptingObjectOfClass:createdClass withParameters:[self resolvedKeyDictionary]];
}
else
r = [super performDefaultImplementation];

if ([r isKindOfClass:[NSScriptObjectSpecifier class]])
return r;

return [r objectSpecifier];
}
- (id)subjectsSpecifier
{
NSAppleEventDescriptor *subjDesc = [[self appleEvent] attributeDescriptorForKeyword: 'subj'];
NSScriptObjectSpecifier *subjSpec = [NSScriptObjectSpecifier _objectSpecifierFromDescriptor: subjDesc inCommandConstructionContext: nil];
return [subjSpec objectsByEvaluatingSpecifier];
}

Monday, June 25, 2007

Done!

I completed my tasks for today. The feature list now covers most of the features that the sdef does. Now that I've sent out a request for comments, I expect that many more ideas will come my way.

Plan 1

• Finish Adium's Unit Tests, viewable at http://trac.adiumx.com/wiki/FixAndExpandAppleScriptSupport
• Post blog report when done on Adium's blog.
• Send email to adium-devl, with information about the unit tests.