Can AppleScript do this?

Hey, my friend and I were talking today, and he was telling me that he spends way to much time on facebook(kind of like myspace, and it’s a website), anyways what it comes down to is that he spends too much time on facebook and needs a way to limit his own use. Now I’m a PC guy and I’m used to coding/scripting, so I doubt the language is beyond my grasp, however I don’t really know much about it, or even if its capable of what I need it to do. So here is what I need it to do:

  1. Tell if the web browser is currently on facebook, either by getting the title of the website(as in what is at the top left of your window. i.e. on this site for me it says “Applescript Forums | Macscripter / Post new …”) and search it and identify when facebook is in the string, or perhaps some other method of being able to identify if it is on the facebook website.
  2. Be able to hold variables and keep track of time. Basically he asked me to make the program so he has 15 minutes every 2 hours. So I would most likely assign a variable to keep track of how much time he has spent on facebook, and then after 15 minutes, just completely exit out of a any browser that accesses facebook for the next 2 hours.
  3. startup when his computer starts, and run in an infinite loop whenever his computer is on
  4. Him not being able to exit the script would be ideal. Perhaps having a set of hotkeys to press for it to exit (i.e. alt+ctrl+f or something). It’s going to be useless if it is in his dock and he can just exit out of it when he pleases. I’m not 100% sure how apple script works, but I doubt there is a way around this one. My guess since it’s programmed into the OS, there isn’t a way around this, but this is a pretty big one. Maybe if he tries to exit it, then his computer exits. I dunno, if there isn’t a way to stop him from being able to access it, then any creative solutions would be helpful. Yes it’s true he could just exercise self-control, but it’s easy to talk yourself out of something when it’s just sitting right in front of you. He had planned on just deleting his facebook account completely, however it’s a very vital thing for college students to communicate almost, so I told him that I would look into ways to just restrict his time use of it. Any other options beside Applescript are appreciated also. Thanks!!!

Hi and welcome :slight_smile:

#1: These things could be done with AppleScript in conjunction with a scheduler engine like launchd

#2l: With a little knowledge of the computer every limitation can be bypassed

#3l: If your friend can’t control himself by trying to disable the limitation, he’s obviously addicted and needs professional help