Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Using cron to display reminders in the Finder UNIX
I've been trying to figure out how to use cron to schedule reminders that provide an alert in a GUI window even if the Terminal isn't being used. The problem is that osascript can't be used if user feedback is needed. Display dialog won't work with osascript, but you can use osascript to tell the Finder (or some other application) to do something, which can include "display dialog." Then, the Finder apparently handlies the Apple Events that osascript can't from the command line.

Try adding these commands to your crontab file (see earlier hints for help on cron.

Use dialog:
osascript -l AppleScript -e 'tell Application "Finder" to display dialog "Call Frank" '

Speak text:
osascript -l AppleScript -e 'tell Application "Finder" to say "Call Frank" '

Use alert:
osascript -l AppleScript -e 'tell Application "Finder" to display alert "Call Frank" '

Now, if I could just figure out how to do this with a floating, modeless dialog and have it catch cron events that took place while the computer was off or sleeping....
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)

Using cron to display reminders in the Finder | 15 comments | Create New Account
Click here to return to the 'Using cron to display reminders in the Finder' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Just a thought...
Authored by: Drogoul on Oct 29, '02 10:48:35AM

Couldn't you make an AppleScript Studio app, launched at startup, that would stay in the background and to which (instead of the Finder) you could send these orders ? I do not have time to try it, but it makes sense. If you add to it a modeless window + a text field + an event that modifies this text field (enclosed in "on display(aText) ... end display"), you could tell it things like:

tell application "Displayer" to display("abc")


[ Reply to This | # ]
Another way
Authored by: midan23 on Oct 29, '02 11:02:07AM

If you have XDarwin, you can try "xmessage"

But the best and easiest solution should be something like "xmessage" as cocoa application ...

[ Reply to This | # ]
Authored by: fireproof on Oct 29, '02 09:54:41PM
Hmmm, don't know what I was doing, but the scripts in the original article weren't working for me -- kept getting "execution error: Finder got an error: "Call Frank" doesn't understand the display dialog message. (-1708)" But a slightly simpler version works OK: osascript -l AppleScript -e 'say "Iam sorry Dave. I cant do that." ' &

[ Reply to This | # ]
Authored by: jiclark on Oct 29, '02 11:36:14AM

I tried this, and it worked the first time, but all the new iterations I've entered (via Cronnix) have not worked. I've checked in Console, and there's no record of anything even trying to happen. I can't remember if there's a different log I need to look in, but the default Console log shows nothing.

What gives?

[ Reply to This | # ]
Authored by: persson on Oct 29, '02 11:36:49AM

I believe that the unix commnads of "at" and "atrun" provide time based execution even when it is overdue because of say, the system being asleep. Might be worth a look.

[ Reply to This | # ]
Authored by: Accura on Oct 29, '02 09:28:38PM
yeah thats right, there is this story thats explains how to setup and use the at command.

[ Reply to This | # ]
cron after sleep
Authored by: lolopb on Oct 29, '02 04:07:46PM

Use anacron instead of cron.

[ Reply to This | # ]
Fails if Finder user is not current user
Authored by: timrand on Oct 29, '02 09:39:22PM

I tried to do this with another user logged into the system and it failed with this error:

kCGErrorIllegalArgument : initCGDisplayState: cannot map display interlocks.
kCGErrorIllegalArgument : CGSNewConnection cannot get connection port
INIT_Processeses(), could not establish the default connection to the WindowServer.Abort

I had thought this would be a great hack.

[ Reply to This | # ]
Fails if Finder user is not current user
Authored by: persson on Oct 30, '02 01:40:55PM

I am assuming that your goal was to run a program from the command line that the user who is current logged in would see.

If you are an admin (and therefore in the "admin" group which has an entry in /etc/sudoers):

sudo open <whatever you want>

or (perhaps safer since the command will not run as root but as the logged in user):
sudo -u <loggedInUsername> <whatever you want>

[ Reply to This | # ]
Fails if Finder user is not current user
Authored by: daedalus921 on Jun 04, '03 10:42:44PM

Then is there any good way to send a message to the admin of a remote computer through an alert/dialog box? I know 'write' and 'talk' work perfectly well, but only if the person's got Terminal open.

[ Reply to This | # ]
Or, you could just use ...
Authored by: Anonymous on Oct 29, '02 11:04:01PM
Or, you could just use Pester.

[ Reply to This | # ]
display alert ?
Authored by: billearl on Oct 30, '02 10:54:10AM

Where did "display alert" come from? I can't get it to work (using AppleScript alone).

[ Reply to This | # ]
display alert ? (wait for Tiger)
Authored by: Interrobang on Aug 25, '04 05:12:35PM

Yes, this threw me too. It looks like 'display alert' is part of a new version of Applescript that's coming in Tiger. More info here:

[ Reply to This | # ]
display alert ?
Authored by: jacobolus on Apr 30, '06 12:46:25AM

well, back in 2002 it was pretty worthless, but works great in Tiger!

[ Reply to This | # ]
Using cron to display reminders in the Finder
Authored by: elmspop on Aug 27, '04 09:17:28AM

This is my first comment!
You can use GeekTool to create the window to output this information. It can display the outputs of apple/shell scripts right on your desktop and best of all - ITS FREE!! Hope this helps!

[ Reply to This | # ]