Dynamic framework loading and properties
Dynamic framework loading and properties
- Subject: Dynamic framework loading and properties
- From: "email@hidden" <email@hidden>
- Date: Sat, 11 Dec 2010 22:01:59 +0000
In the script below I load a framework bundle and resolve a class definition.
I cannot however resolve the property kABFirstNameProperty.
This script is executed within a Cocoa foundation tool.
If I statically link this app to the AddressBook framework then I can resolve the property.
Any ideas?
-- Cocoa classes
property NSBundle : class "NSBundle"
script KosmicTask
property parent : class "NSObject"
(*
task entry point
*)
on KosmicTask()
try
-- load the framework
NSBundle's bundleWithPath_("/System/Library/Frameworks/AddressBook.framework")'s load
-- get the address book
set ABAddressBook to class "ABAddressBook" of current application
-- set firstName to current application's kABFirstNameProperty -- <<<<< this fails
set firstName to "First"
-- access the framework class
set thePerson to ABAddressBook's sharedAddressBook's |me|
set myResult to thePerson's valueForProperty_(firstName)
-- myResult is complete, task will end
return {kosmicData:myResult}
on error errorMessage number errorNumber
return {kosmicError:errorMessage}
end try
end KosmicTask
end script
Regards
Jonathan Mitchell
Developer
Mugginsoft LLP
http://www.mugginsoft.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden