#!/usr/bin/perl #ported from similar AppleScript version at: # http://people.engr.ncsu.edu/jayoung/site/pages/adium-group-chat-bookmarks-via-applescript # requirements: # * turn on UI scripting in Universal Access in System Prefs # * make glue for iChat (using Tiger): # these steps must be done only once per machine: # cd /System/Library/Perl/Extras/bin/ # sudo ./gluedialect # sudo ./gluescriptadds # sudo ./gluemac '/System/Library/CoreServices/System Events.app' # sudo ./gluemac /System/Library/CoreServices/Finder.app # this step must be done once per application to script: # sudo ./gluemac /Applications/iChat.app # * have a Jabber account this will work with, and be connected with it use warnings; use strict; use Mac::Glue ':all'; my @rooms = ( { name => 'roomname' }, ); my $ichat = new Mac::Glue 'iChat'; my $sysevt = new Mac::Glue 'System Events'; $sysevt->ERRORS(1); $ichat->activate; my $join_menu = $sysevt->obj( menu_item => "Go to Chat" . chr(201), # 201 == ellipsis menu => 1, menu_bar_item => 'File', menu_bar => 1, application_process => 'iChat' ); my $join_window = $sysevt->obj( window => 'Go to Chat', application_process => 'iChat' ); my $account_list = $join_window->obj(pop_up_button => 1, group => 1); my $join_button = $join_window->obj(button => 'Go'); my $room_fieldb = $join_window->obj(text_field => 1); my $room_field = $room_fieldb->prop('value'); for my $room (@rooms) { $join_menu->click; $account_list->click; $account_list->obj( menu_item => 'Jabber', property => 'menu' )->pick; sleep 1; # give fields a chance to appear # Join button cannot be clicked until we "type" something $sysevt->keystroke("\ti"); sleep 1; $room_field->set(to => param_type(typeChar, $room->{name})); $join_button->click; } __END__