Thursday, October 28, 2010

focus

I had been running some scripts, but kept getting distracted.

I found a linux script for a dialog alert, but not one for OSX, so here is my modified script for OSX.


#!/bin/bash

eval $@

if [[ $? -eq 0 ]]; then
osascript -e 'tell application "Finder"' -e "activate" -e "display dialog \"Command '$@' in $PWD completed.\"" -e 'end tell';
else
osascript -e 'tell application "Finder"' -e "activate" -e "display dialog \"Command '$@' in $PWD failed! $@\"" -e 'end tell';
fi

2 comments:

Devin Dawson said...

Another option depending on whether you leave your volume up or not is to replace the dialog popup with "say 'victory is mine'" and "say 'nothing good came of that rado'". For some reason, I find that equally useful for long running scripts but less annoying than the modal dialog.

rado said...

Nice Devin, I'll have to try it out.