[MacRuby-devel] [MacRuby] #744: map on an array delivered by terminal app via scripting bridge gives an immutable error
MacRuby
ruby-noreply at macosforge.org
Fri Jun 18 16:47:26 PDT 2010
#744: map on an array delivered by terminal app via scripting bridge gives an
immutable error
----------------------------+-----------------------------------------------
Reporter: jazzbox@… | Owner: lsansonetti@…
Type: defect | Status: closed
Priority: major | Milestone: MacRuby 0.7
Component: MacRuby | Resolution: invalid
Keywords: |
----------------------------+-----------------------------------------------
Changes (by martinlagardette@…):
* status: new => closed
* resolution: => invalid
Comment:
I'm not sure how it worked in MacRuby 0.5. Are you sure it does work?
Doesn't work with my copy of 0.5.
In fact, it doesn't work in Obj-C either, so I'm not really sure how we
can make it work within MacRuby :P
{{{
#!text/x-objc
#import <Foundation/Foundation.h>
#import <ScriptingBridge/ScriptingBridge.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
SBApplication *app = [SBApplication
applicationWithBundleIdentifier:@"com.apple.terminal"];
SBElementArray *windows = [app windows];
NSLog(@"%@", [windows class]);
// This raises "can't add an object that already exists"
[windows addObject:@"Window name"];
int i = 0;
for (id termWindow in windows) {
// Same for that
[windows replaceObjectAtIndex:i++ withObject:[termWindow name]];
}
[pool drain];
return 0;
}}}
I'm closing the bug right now, bug feel free to re-open the bug if you
have an Obj-C version that modifies the array that I would not have
thought of.
--
Ticket URL: <http://www.macruby.org/trac/ticket/744#comment:1>
MacRuby <http://macruby.org/>
More information about the MacRuby-devel
mailing list