Newbie: applescript "call method" to obj-c method (booleans & image data)
Newbie: applescript "call method" to obj-c method (booleans & image data)
- Subject: Newbie: applescript "call method" to obj-c method (booleans & image data)
- From: Loren Ryter <email@hidden>
- Date: Sat, 14 Jun 2008 12:08:21 -0400
- Thread-topic: Newbie: applescript "call method" to obj-c method (booleans & image data)
Hell all,
I'm struggling through learning some basic obj-c to implement some functions
that are not supported in applescript, by creating custom obj-c classes and
passing parameters to those classes using call methods.
Not doing terribly badly, but it's slow going given my level of
understanding. I hope y'all don't mind if I ask some rather newbie
questions.
These 2 I posted also on Growl discuss google group but have not yet
received an answer.
== #1 ==
First issue, how do I get a method to properly receive a BOOLEAN
(passed as true/false from AppleScript's "call method")
-(void)notifyWithPathImage:(NSString *)aPath WithName:(NSString
*)anotif WithTitle:(NSString *)atitle WithMessage:(NSString *)amsg
WithSticky:(BOOL *)aStick WithClick:(NSString *)aClick
[GrowlApplicationBridge notifyWithTitle:atitle
description:amsg
notificationName:anotif
iconData:nil
priority:0
isSticky:aStick
clickContext:aClick];
XCode build complains that argument 6 "makes integer from pointer
without a cast". I tried to use:
(NSNumber *)aStick
instead of
(BOOL *)aStick
...and tried to use:
isSticky:[NSNumber numberWithBool:aStick]
instead of:
isSticky: aStick
But then run into incompatible data type warnings I believe.
== # 2 ==
Second, I'm trying to duplicate functions that are part of Growl's
applescript support, which allows image parameters such as:
A. the name of an application
B. the path of an image file
However Growl's cocoa implication wants apparently raw picture data
(iconData parameter):
To pass a posix path (as NSSstring) I tried (with aPath specified):
iconData:[NSImage initWithContentsOfFile:aPath]
System log shows:
*** +[NSImage initWithContentsOfFile:]: unrecognized selector sent to
class 0xa0a2febc
and to pass an application name (as NSString) I tried:
iconData:[NSImage imageNamed:anApp]
For this one, the notification was displayed but with my own app icon
rather than "Safari" which I specified (by anApp)
Thanks again.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden