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

Click here to return to the 'Automate an Internet content filter' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Automate an Internet content filter
Authored by: karljam on Oct 04, '10 10:31:42PM

Until someone figures out how to run the script with variables in iCal, I use the unix utility cron as mentioned in the hint. Here's how:

  1. Open Terminal and type crontab -e. (Terminal will then fire up a unix-based text editor.)
  2. In the next screen, move the cursor down to a blank line and paste this:
    0 16 * * 1,2,3,4,5 osascript /Applications/kerfi/Applescript/selfcontrol.scpt 300
    0 22 * * 1,2,3,4,5 osascript /Applications/kerfi/Applescript/selfcontrol.scpt 1080
  3. Edit both lines to reflect the actual path of the script on your computer.
  4. Exit the text editor and save. Depending on the editor, this command can vary; I'll venture to guess it's Pico or Nano, in which case you can just type Ctrl-X followed by Y.
You can now quit Terminal. These two lines you pasted translate into two scheduled jobs. The first one runs at 16:00 on every day of every month, as long as it's Monday-Friday (1,2,3,4,5) for 240 minutes (that is, until 21:00). The second one runs at 22:00 for 1020 minutes (until 15:00). To have the script run on weekends as well, you could replace 1,2,3,4,5 with a *. To delete these jobs, just go back into crontab and delete these two lines.

Cron is great for scheduling just about anything, including backing up certain folders to cleaning up your desktop. For more info check out this hint.

[ Reply to This | # ]