Register
It is currently Mon Sep 01, 2014 5:27 pm

NEWBIE - Please can someone help with this automation script


All times are UTC - 6 hours


Post new topic Reply to topic  [ 9 posts ] 
Author Message
 PostPosted: Fri Nov 29, 2013 11:33 am   

Joined: Fri Nov 29, 2013 11:26 am
Posts: 6
Hi guys,

I am not a programmer and have no wish to be one. However I do suffer from ADD and get routinely distracted by the internet and waste days of my life. I have found this superb software called Self Conrtol that blocks my internet access for a given set of hours.
http://selfcontrolapp.com

How I wish they had built into this a scheduler, so laymen like me could set it to block the internet for large chunks of the day.

However I have to learn this and try to apply it. http://hints.macworld.com/article.php?s ... 1214648362

I have absolutely zero clue but have tried for the last few days. I have tried quicksilver, Ical and now automater. None of them do what I want them to do.

I simply want self control to kick in at 2200 through to 1100. Then 1200 to 1400. Then 1500 to 2000.

Can anyone help me with this. Im spending more time that ever here trying to get this to work.

Many thanks


Top
 Profile  
 PostPosted: Fri Nov 29, 2013 5:52 pm   
User avatar

Joined: Wed Jun 08, 2011 8:27 am
Posts: 189
Location: outer Shpongolia
Where are you stuck?

In the end, you have to add the following to your crontab file:
Code:
# 12h-14h
0 12 * * * osascript /Applications/kola/Applescript/selfcontrol.scpt 120

# 15h-20h
0 15 * * * osascript /Applications/kola/Applescript/selfcontrol.scpt 300

# 22h-11h
0 22 * * * osascript /Applications/kola/Applescript/selfcontrol.scpt 780

This comment might help you if you're lost on this part.

For your information, the script is not written in bash(1) but a proprietary scripting
language made by Apple called AppleScript that needs osascript(1) in order to
be interpreted / understood; it's used here to execute the script from the crontab file.


Top
 Profile  
 PostPosted: Sat Nov 30, 2013 5:11 am   

Joined: Fri Nov 29, 2013 11:26 am
Posts: 6
jsz

Hi mate, thanks very much for your reply. Im at work at the mo but wanted to say thank you. Ill try it out tonight and report back.


Top
 Profile  
 PostPosted: Sat Nov 30, 2013 7:50 am   

Joined: Fri Nov 29, 2013 11:26 am
Posts: 6
Ok, im back and can update properly.

The script runs fine and works a charm if I trigger it manually. But thats the point. I don't want to trigger it manually I want it to auto launch the same time day in day out.

To trigger it I have tried an app called quicksilver, also OSX's Automator and even iCal. All of these report problems.

Thanks for taking the time to write that code out for me, but I have no idea what or where a contrab file will be. I only learned what a script was three days ago. :-/

Your advice is greatly appreciated.


Top
 Profile  
 PostPosted: Sat Nov 30, 2013 11:11 am   
User avatar

Joined: Wed Jun 08, 2011 8:27 am
Posts: 189
Location: outer Shpongolia
Ok, so if the script runs fine, you only have to edit your crontab file to schedule the jobs.
As for the how-to, karljam explains it all in his comment I linked above.


Top
 Profile  
 PostPosted: Sat Nov 30, 2013 2:53 pm   

Joined: Fri Nov 29, 2013 11:26 am
Posts: 6
Ok mate,

I think I've done everything. How do I save the contab? No option in Terminal;


Top
 Profile  
 PostPosted: Sat Nov 30, 2013 2:57 pm   

Joined: Fri Nov 29, 2013 11:26 am
Posts: 6
Oh hang on. Now when I run the script manually it doenst run and throws out the following error.

System Events got an error: Can’t set window "SelfControl" of process "SelfControl" to 15.

I have changed this from 1 to 15 as per instructions as the current version of SelfControl only allows multiples of 15. Still neither 1 or 15 will work?



EDIT - {LEASE IGNORE ABOVE. BY DOING NOTHING OTHER THAN PRESSSING RUN 5 MINS LATER THIS PROBLEM HAS FIXED ITSELF.


Ok, I have entered ifo into cron thingy and then exited out of it. Im guessing at 2200 it should all kick in?


Top
 Profile  
 PostPosted: Sat Nov 30, 2013 5:11 pm   

Joined: Fri Nov 29, 2013 11:26 am
Posts: 6
UPDATE:- Its way past 2200 and not blocker has kicked in. Anyone?


Top
 Profile  
 PostPosted: Mon Dec 02, 2013 7:11 pm   
User avatar

Joined: Wed Jun 08, 2011 8:27 am
Posts: 189
Location: outer Shpongolia
Did you put the cron job lines I gave you in your crontab file and not his sample line?
Did you make sure the changes were correctly saved?

Did you save the script as « selfcontrol.scpt »?
Is it really located in /Applications/kola/Applescript ?

I guess it's a path issue.


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP