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


Click here to return to the 'Ok, this will work better...' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Ok, this will work better...
Authored by: jriskin on Jul 29, '06 02:25:08AM
Only one problem...since I don't set the variable, it'll never toggle...so I just spent a few minutes learning some applescript...so if this is all bad form, forgive me. I also didn't want to muck around with other apps like butler or geektool, so i just had it read the current setting aloud.

set thePath to (path to home folder) & ".monitorsleep" as string

try
	set thetime to (read file thePath as integer)
on error
	set fRef to (open for access file thePath with write permission)
	set thetime to 10
	write thetime as integer to fRef
	close access fRef
end try

set thetime to (read file thePath as integer)

if thetime is 1 then
	set thetime to 10
	say "Ten"
else
	set thetime to 1
	say "One"
end if
set fRef to (open for access file thePath with write permission)
write thetime as integer to fRef
close access fRef

do shell script ("pmset force dim " & thetime)
Hope it works out. If someone figures out how to set it to 1 second THAT would rock =)

[ Reply to This | # ]
Ok, this will work better...
Authored by: ob1cannoli on Jul 29, '06 08:29:11AM

thanks for that! I personally don't mind the password but I figure there are users that would.
and yes, the end-all-be-all of solutions would be an on/off key without any waits at all, but for now this is the best i've found.



[ Reply to This | # ]