Send click event to dialog shown through display dialog command in OS X Terminal

0

I have an sh script that displays a dialog; this dialog can be closed by the user but I am looking at a gracious way to close it, from within another similar script, run at a particular moment, if this doesn't happen. My command is:

osascript -e 'display dialog "Hello World! This notification will be closed in the future, due to an external trigger."'

The event that should trigger the close is asynchronous, therefore I cannot use the give up option.

Is there a way to accomplish this, or should I simply kill the process instead?

elder elder

Posted 2015-08-19T14:02:31.303

Reputation: 306

Answers

0

The somewhat trivial approach was to create another script, that is identifying and killing the above one:

pkill -f "Hello World! This notification will be closed in the future, due to an external trigger."

There may very well be a more elegant way to do it...

elder elder

Posted 2015-08-19T14:02:31.303

Reputation: 306