I'd like to change a notification that I receive from the network in order 
to add a callback action.  I don't have control of the client originating 
the notification, but I've found that Growl supports AppleScript with the 
ability to change notifications in /Users/USER/Library/Application 
Scripts/com.Growl.GrowlHelperApp/Rules.scpt.  What I want to do is set the 
callback url to a local executable, so that when the notification is 
clicked the executable does something.

Unfortunately, with Growl 2.x sandboxed in OSX, I can't seem to find a 
documented method to make this work.  I've tried placing my file in both 
/Users/USER/Library/Application Scripts/com.Growl.GrowlHelperApp/Rules and 
/Users/dpotter/Library/Containers/com.Growl.GrowlHelperApp/Data, yet Growl 
still shows "No such file or directory".  I'm beginning to think that 
there's a more general reason for this and that it may not be related to 
the file itself, as I get the same error even when the URL is changed to 
something trivial, like "http://www.google.com";.

Does anyone have experience with setting the callback URL in a notification 
with Rules.scpt?  Or, if there's another way to do this except for changing 
the notification as sent by the client, I'd be willing to explore that as 
well.  I've found that my executable works as a ScriptAction, but I only 
want it to run when the notification is clicked.

5/18/16 2:17:11.667 PM Growl[9624]: completion error: Error 
Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" 
UserInfo={NSURL=file://localhost/Users/USER/Library/Application%20Scripts/com.Growl.GrowlHelperApp/Rules.scpt,
 
NSLocalizedFailureReason=/Users/USER/Library/Application 
Scripts/com.Growl.GrowlHelperApp/Rules.scpt:246:371: execution error: Can’t 
get URL "file:///ActivateVMware". (-1728)
}
5/18/16 2:44:47.754 PM Growl[9624]: completion error: Error 
Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" 
UserInfo={NSURL=file://localhost/Users/USER/Library/Application%20Scripts/com.Growl.GrowlHelperApp/Rules.scpt,
 
NSLocalizedFailureReason=/Users/USER/Library/Application 
Scripts/com.Growl.GrowlHelperApp/Rules.scpt:321:383: execution error: Can’t 
get URL "http://www.google.com";. (-1728)
}


Rules.scpt:
using terms from application "Growl"
    on evaluate notification with notification
        ignoring case
            --Rules go in here
            --Ultimately return what you want Growl to do with the 
notification
            if notification's app name is "Outlook" then
                --set the notification's callback to url 
"file:///ActivateVMware"
                set the notification's callback to url 
"http://www.google.com";
                return {notification return:notification}
            end if
        end ignoring
    end evaluate notification
end using terms from

ActivateVMware:
#!/usr/bin/env osascript

tell application "VMware Fusion"
    reopen -- unminimizes the first minimized window or makes a new default 
window
    activate -- makes the app frontmost
end tell

-- 
You received this message because you are subscribed to the Google Groups 
"Growl Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/growldiscuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to