clickable notifications with applescript
clickable notifications with applescript
How do I create clickable notifications with applescript? I couldnt find it anywhere. I would like it to go to a web page.
Thanks
Thanks
In looking at the bindings for AppleScript it doesn't appear that they currently support the clickability of notifications and such you should file a Trac ticket to remind us that this functionality is needed.
Try my software!
#define ADIUMX pimp //by me
#define QUESTION ((2b) || (!2b))
Have you hugged a programmer today?
#define ADIUMX pimp //by me
#define QUESTION ((2b) || (!2b))
Have you hugged a programmer today?
Apparently Growl's Trac isn't open like Adium's, my apologies. I'll make a ticket momentarily. If you could, please post desired syntax/terminology for the changes and these will be included in the ticket as well.
Try my software!
#define ADIUMX pimp //by me
#define QUESTION ((2b) || (!2b))
Have you hugged a programmer today?
#define ADIUMX pimp //by me
#define QUESTION ((2b) || (!2b))
Have you hugged a programmer today?
Try my software!
#define ADIUMX pimp //by me
#define QUESTION ((2b) || (!2b))
Have you hugged a programmer today?
#define ADIUMX pimp //by me
#define QUESTION ((2b) || (!2b))
Have you hugged a programmer today?
See also http://trac.growl.info/ticket/255
ingmarstein said it didn't look to be possible for technical reasons.
ingmarstein said it didn't look to be possible for technical reasons.
Good catch, I was foolish enough not to search and that's what I getnanovivid wrote:See also http://trac.growl.info/ticket/255
ingmarstein said it didn't look to be possible for technical reasons.
Try my software!
#define ADIUMX pimp //by me
#define QUESTION ((2b) || (!2b))
Have you hugged a programmer today?
#define ADIUMX pimp //by me
#define QUESTION ((2b) || (!2b))
Have you hugged a programmer today?
If GrowlHelperApp was able to return a tag as a reference to a notification (and then accept that tag again), I don't think this would be impossible with code similar to:
It just requires a tag to be able to preserve state.[/code]
Code: Select all
tell application "GrowlHelperApp" to set theTag to (display notification "...")
repeat with x from 1 to 100
delay 0.1
tell application "GrowlHelperApp" to set theStatus to (get status of notification theTag)
if theStatus = "Clicked" then
-- do stuff
else if theStatus = "Closed" then
exit repeat
end
end repeat-
Wooden Brain Concepts
- Latté
- Posts: 50
- Joined: Wed Dec 27, 2006 2:37 am
Documentation
Can you point to some documentation on clickable notifications? I use AppleScript too but there might be a way to get distributed notifications in AS Studio projects at least. It involves using a bit of C code in a studio project and having the project respond to an invisible button (on clicked).
-
Wooden Brain Concepts
- Latté
- Posts: 50
- Joined: Wed Dec 27, 2006 2:37 am
Re: clickable notifications with applescript
OK guys... revisiting this topic.
I tried to find a way to fudge this one but so far have been unsuccessful. I really believe this should be possible in AppleScript Studio by defining some C sources and connecting them to buttons on the interface. The idea is to use C code to click an invisible button and set the title of the button to the result string.
I was able to do something like this to get distributed notifications from iTunes, with some help from jobu:
http://bbs.macscripter.net/viewtopic.php?id=19608
A method he suggested in an email was to set the title of the connected button to the notification string, something like this (but obviously for Growl not for iTunes):
In other words, the:
in the growl framework would click this invisible button and pass the clickContext to the title of the Action button. then it can be handled with the on clicked handler.
unfortunately i just don't know enough C to write this.
the other problem I see is the appelscript dictionary does not support the clickContext parameter. There would have to be some way to send this parameter.
so ideally you could use applescript to display notifications, but only the "growlNotificationWasClicked" event would get handled in C and passed to this button.
Can anyone put this all together?
Failing this, if anyone could provide a really simple XCODE project with the growl framework built in that actually sends notifications and responds to clicks, I might be able to piece it together from that. but with just the commented framework in the SDK that's not enough for me to go on.
I tried to find a way to fudge this one but so far have been unsuccessful. I really believe this should be possible in AppleScript Studio by defining some C sources and connecting them to buttons on the interface. The idea is to use C code to click an invisible button and set the title of the button to the result string.
I was able to do something like this to get distributed notifications from iTunes, with some help from jobu:
http://bbs.macscripter.net/viewtopic.php?id=19608
A method he suggested in an email was to set the title of the connected button to the notification string, something like this (but obviously for Growl not for iTunes):
Code: Select all
-(void)handleGrowlNotification:(NSNotification *)aNotification {
//NSLog(@"Handle Notification Growl");
//NSLog(@"The whole userInfo dictionary:");
//NSLog([[aNotification userInfo] description]);
NSString *playerState = [[aNotification userInfo] objectForKey:@"Player State"];
playerState = ((playerState) ? playerState : @"Unknown");
[asActionButton setTitle:playerState];
[asActionButton performClick:nil];
}
Code: Select all
- (void) growlNotificationWasClicked:(id)clickContext;
unfortunately i just don't know enough C to write this.
the other problem I see is the appelscript dictionary does not support the clickContext parameter. There would have to be some way to send this parameter.
so ideally you could use applescript to display notifications, but only the "growlNotificationWasClicked" event would get handled in C and passed to this button.
Can anyone put this all together?
Failing this, if anyone could provide a really simple XCODE project with the growl framework built in that actually sends notifications and responds to clicks, I might be able to piece it together from that. but with just the commented framework in the SDK that's not enough for me to go on.
-
Wooden Brain Concepts
- Latté
- Posts: 50
- Joined: Wed Dec 27, 2006 2:37 am
Re: clickable notifications with applescript
OK...
I got it sussed out.
Turns out the biggest stumbling block was this piddling issue of image sizes for high resolution images. For that sordid history see:
http://forums.cocoaforge.com/viewtopic.php?f=6&t=16005
This is the resulting sample project:
http://www.woodenbrain.com/sw/betas/WBC_ASS_Growler.zip
WBC ASS Growler is made available as a demonstration of a method of how to post clickable notifications to Growl with AppleScript Studio.
It creates a custom c class, which actually posts the notifications and receives call backs from the click context.
In its current version, you can pass a string click context to this "GrowlObserver" class. If the click context is a URL beginning with "http://" the class will receive the callback and open the link in the default browser.
If it is anything else, it will pass the click context back to the alternate title of a button (usually invisible in the GUI) and click it. You can then handle that click.
======
This sample project is provides a courtesy to the community. Please feel free to use with credit.
If open source, comments are fine for credit, otherwise about box or similar. Please include link to http://www.woodenbrain.com.
I got it sussed out.
Turns out the biggest stumbling block was this piddling issue of image sizes for high resolution images. For that sordid history see:
http://forums.cocoaforge.com/viewtopic.php?f=6&t=16005
This is the resulting sample project:
http://www.woodenbrain.com/sw/betas/WBC_ASS_Growler.zip
WBC ASS Growler is made available as a demonstration of a method of how to post clickable notifications to Growl with AppleScript Studio.
It creates a custom c class, which actually posts the notifications and receives call backs from the click context.
In its current version, you can pass a string click context to this "GrowlObserver" class. If the click context is a URL beginning with "http://" the class will receive the callback and open the link in the default browser.
If it is anything else, it will pass the click context back to the alternate title of a button (usually invisible in the GUI) and click it. You can then handle that click.
======
This sample project is provides a courtesy to the community. Please feel free to use with credit.
If open source, comments are fine for credit, otherwise about box or similar. Please include link to http://www.woodenbrain.com.