On 21 Feb 2008, at 15:05, Andreas Höschler wrote:

Hi all,

I have a special problem. A foreign non-GNUstep application (actually Star Office) is currently been modified to call a script whenever a user saves a file. I would like to use this to trigger an action in a GNUstep application (grab the Star Office file from the temporary directory and store it in a database).

The question is, how can a script (GNUstep tool) send a notification to a GNUstep application? I used tcp sockets so far for IPC but this does not seem to be appropriate in this case. Any ideas?

Thanks,

  Andreas

If all you need is a notification, then you can send a distributed notification. The simplest way of doing this would be to write a simple tool that would put its arguments into the userinfo dictionary for a distributed notification and then send it.

My code would look something like this:

int main(int argc, char ** argv)
{
        [[NSDistributedNotificationCenter defaultCenter]
                postNotificationName:@"File Modified"
                object:[NSString stringWithUTF8String:argv[1]
userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithUTF8String:argv[2]]
                        forKey:@"Filename"]
                deliverImmediately:YES];
        return 0;
}

You'd compile this to something like notify and then call it from your shell script as:

notify "StarOffice" $FILENAME

In your GNUstep code you'd then listen for distributed notifications from the StarOffice application.

David



_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to