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: thirstypixels on Aug 30, '10 10:36:11AM

I'm one of those, "I use Photoshop and other graphics programs heavily but I have no idea how they actually work," kinda computer user... so here's the question: I want to automate SelfControl so that it only lets me use the internet from 3-4 and 9-10 pm. what should I write in the code to make it do that? Thanks so much. I'm extremely excited about using this program - I have a fancy desktop with a gorgeous Wacon Cintiq screen that I do my work on and I hate how distracting it is! I tried to get my network card removed and learned that it's attached to the motherboard! A piece of paper never gives me the option to look up microcephaly and whatever else is related for hours on end. Thanks a million.



[ Reply to This | # ]
Automate an Internet content filter
Authored by: thirstypixels on Sep 01, '10 02:17:51PM

I also had a hard time getting the script to work and I don't think I quite understood how to install the key-chain thingy... help!



[ Reply to This | # ]
Automate an Internet content filter
Authored by: karljam on Oct 04, '10 11:10:32PM

Once you've downloaded Usable Keychain Scripting and double-clicked on the .dmg file, go to Finder, click on the disk image named "UKS 1.0b3" in the left column, and there you will find a file named "Usable Keychain Scripting." To install, drag it to any folder on your computer. I keep mine in /System Folder/Scripting Additions/.


If you really don't want to deal with keychains, you could just save your admin password in the script itself, though I would not recommend it. In that case you could delete all the code from

tell application "Usable Keychain Scripting" 
all the way up to, but not including
tell application "SelfControl" to activate
and replace it with this line:
set myPass to "yourpassword"

Keep in mind "yourpassword" must be replaced with your admin password. It's simple, but dangerous, as it leaves your password out in the open. You might want to change the permissions of the directory containing your script to be only readable by you.



[ Reply to This | # ]
Automate an Internet content filter
Authored by: gunnersmurf on Nov 21, '10 07:45:31PM

When I click on Usable Keychain Scripting nothing happens.

I have placed in in a folder under documents. I click... nothing. But if I try to delete it... it says it's running.

Dunno where tho.

Can someone explain?



[ Reply to This | # ]
Automate an Internet content filter
Authored by: karljam on Mar 15, '11 07:39:20AM

That's all you need to do. You don't need to run it. Just drop it somewhere on your computer, and your applescript will automagically find it.



[ Reply to This | # ]
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 | # ]
Automate an Internet content filter
Authored by: karljam on Oct 04, '10 10:45:12PM

I forgot to mention: If you want to block all internet with SelfControl, go to its main window, click "Edit Blacklist," and choose the "Whitelist" option at the bottom right corner of the domain list.

Now, whenever you run your script, SelfControl will block all websites except those listed on your domain list. If there are no websites listed, you've got a perfect internet blocker, which makes it functionally the same as the commercial app Freedom. Who says Freedom isn't free? :)



[ Reply to This | # ]