Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Result of Obj-C Code Differs from call method to Same Methods



Oh, incidentally, does someone with intimate knowledge of the inner workings
of AppleScript (*cough* Chris Nebel *cough*) know why this Objective-C code
works, but the equivalent call method calls from AppleScript *don't* work?


- (NSDictionary *)setRecord:(NSDictionary *)theRecord label:(NSString *)
theLabel toValue:(id *) theValue;
{
     NSMutableDictionary mutableRecord = [NSMutableDictionary
dictionaryFromDictionary:theRecord];
     [mutableRecord setObject:theValue forKey:theKey];
     return [autorelease mutableRecord];
}

Using call method to call this method works:
(given myRecord, myLabel, myValue)
set myRecord to (call method "setRecord:label:toValue" of myClassWithMethod
with parameters {myRecord,myLabel,myValue})
--result: entry in myRecord with label myLabel is now equal to myValue

But using call method to duplicate the logic within the method doesn't work:
(again, given myRecord, myLabel, myValue)
set mutableRecord to (call method "dictionaryFromDictionary:" of class
"NSMutableDictionary" with parameter myRecord
call method "setObject:forKey:" of mutableRecord with parameters
{myValue,myLabel}
set myRecord to mutableRecord
--result: myRecord is unchanged

Anybody know what gives?

Topher

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden

References: 
 >SOLVED: Changing AppleScript Records with Variable Identifiers (From: "Christopher Hickman" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.