Healthcare

Hi,
we all have responsibilities, thats good so. But lot depends on “how” we do it to succeed.
A lot of students use bad learning habits-they “mean” that learning overtime helps to memorize a lot of stuff. This assumption is terribly wrong.To give our best, we have to do little breaks. Our mind becomes tired and weak if we continue to study for too long time, and our sight becomes tired because of the bright screen light- i don’t know how many realize it, but we all look into a light bulb, looking at the screen. So, lets have a break !

Adjust the lines of spoken text as you like. Jump to “>CUSTOMIZE”

#Healthy Break
#System Events
#0,06
#Developed by Joy, 19.12.13, ->28.12.13
#=====================================
#HELP: 
# 
# ABSTRACT: start a random screensaver every 107 minutes, (+13 minutes Pause = 2Hours) to phase out mind/eyes stress 
# Why 107 minutes? Read about the 'Pomodoro techique' and/or Eye health care; personal quote: -i see tomatoes-
# 
#REQUIREMENTS:
# run this script using launchd. Cresate an appropriate plist and use this schedule-format:
# <key>StartInterval</key>
# <integer>6420</integer>
#
#=====================================
#No Guaranties - Use at your own Risk - this is freeware
#Original Code by joy- Contact me on: http://gothicage.deviantart.com/
#=====================================

on run
	set itunes_running to false
	---------------------------------->CUSTOMIZE
	set the_voice to "Yannick" #"Alex"
	---------------------------------->CUSTOMIZE
	
	tell application "System Events"
		set running_apps to name of processes whose background only is false
		if "iTunes" is in running_apps then
			tell application "iTunes" to if player state is playing then pause
			set itunes_running to true
		end if
		set entertainm_key to my entertainm(running_apps)
		
		if entertainm_key is false then
			#take a break
			---------------------------------->CUSTOMIZE
			say "Starte Ruhe Pause von 13 Minuten in 8 Sekunden" using the_voice #Starting a break of 13 Minute in 8 seconds
			---------------------------------->CUSTOMIZE
			
			set all_screensaver to name of every screen saver
			set rand_nr to random number from 1 to (length of all_screensaver)
			set rand_screensaver to screen saver (item rand_nr of all_screensaver)
			
			#prepeare for your break
			do shell script "sleep 8"
			set old_time to current date
			start rand_screensaver
			set user_cancel to my sleep_monitor()
			
			if user_cancel is false then
				#normal quit
				---------------------------------->CUSTOMIZE
				say "Ende Ruhe Pause" using the_voice #Back to work.
				---------------------------------->CUSTOMIZE
				#wake sequence, it works on Lion v4
				stop rand_screensaver
				activate application "Finder"
				
			else #user cancelled break
				set cu_dt to current date
				set time_left to 13 - ((cu_dt - old_time) div 60)
				---------------------------------->CUSTOMIZE
				say "Pause um " & time_left & " Minuten verkürzt" using the_voice # Pause finished.Minutes earlier
				---------------------------------->CUSTOMIZE
			end if
			#restart work
			if itunes_running is true then
				tell application "iTunes" to if player state is not playing then play
			end if
		else
			---------------------------------->CUSTOMIZE
			say "Pause empfohlen" using the_voice #i recommend a break
			---------------------------------->CUSTOMIZE
		end if
	end tell
end run

on sleep_monitor()
	#check every 6 seconds for user imput, break interval of 13 mins.
	set dd to 0
	set user_cancel to false
	repeat
		set dd to dd + 6
		if dd = 130 then
			exit repeat
		else
			#control user input
			set min_idle to dd
			#do shell script "sleep 1"
			set idle_time to ((do shell script "/usr/sbin/ioreg -c IOHIDSystem | /usr/bin/awk '/HIDIdleTime/ {print int($NF/1000000000); exit}'") as number)
			
			if idle_time ≥ min_idle then
				#nothing happened
				do shell script "sleep 6"
			else
				set user_cancel to true
				exit repeat
			end if
		end if
	end repeat
	return user_cancel
end sleep_monitor

on entertainm(playing_games)
	#gather running games
	set Game_pt to (path to applications folder from user domain as text)
	set entertainm_key to false
	tell application "System Events"
		#set playing_games to name of processes whose background only is false
		
		#check blacklisted media apps and win-wrapper games
		set bla_apps to {"VLC", "DVD Player", "QuickTime Player", "Plex", "cider", "wine", "wineskin"} #"Miro", "Opera", "Skype", "Safari"
		repeat with a in bla_apps
			if exists process a then
				set entertainm_key to true
				exit repeat
			end if
		end repeat
	end tell
	
	return entertainm_key
end entertainm