I’ve created a droplet script that converts movie files on it to mp4 with FFMpeg using a “do shell script” command. Since it’s all running in the background, I created a display dialog after the conversion is finished to let the user know they can go grab the mp4. Here’s the problem, if I leave the dialog up too long the script times out (which makes my script look kind of amateur). I could add a timeout of 5 hours but I feel like there’s got to be a more elegant way to do this. Display notification isn’t a great option because the user might have notifications set to banners instead of alerts… meaning if they look away from their computer they might not realize the render is finished. Is there a solution where I can kill a script and leave the dialog on screen so that, when they get back from lunch, they’ll see the script is finished?
Just curious. I tried this:
do shell script "osascript -e 'tell app \\\"Terminal\\\" to display dialog \\\"A stop dialog with only one button.\\\" buttons \\\"OK\\\" default button 1 with title \\\"and a title\\\" with icon stop'"
It’s not the dialog that times out, it’s the AppleEvent itself that times out. You can run an process in the background and stop the script so the dialog stays open but then you still need to extend the timeout time of the AppleEvent. AppleEvents send to itself never times out so you could show a dialog using osascript since user interaction is allowed these days. If you want to show the dialog in another application/process than osascript you need to wrap a timeout around it.
do shell script "osascript -e 'display dialog \"A stop dialog with only one button.\" buttons \"OK\" default button 1 with title \"and a title\" with icon stop' &>/dev/null &"
Note: the &>/dev/null & part makes sure the output of the program is moved to an void (/dev/null) and the ampersand at the end is putting the process in the background making your script to continue and not wait for osascript to be finished.