Jump to content

Autosleep-Script


  • Please log in to reply
164 replies to this topic

#41
KWS

KWS

    InsanelyMac Protégé

  • Donators
  • 76 posts

Hey KWS, do u know whether VLC/other video apps support AS (smt. like IfVideoIsPlaying= )

VLC's AppleScript support is really limited.
Move application icon over Applescript-Editor (drag'n'drop) and you will see.
It is possible to determine vlc state by checking used buttons, but this changes with program language, in my opinion to much effort ...
:whistle:

#42
nickgosling

nickgosling

    InsanelyMac Protégé

  • Just Joined
  • Pip
  • 4 posts
Loving this script.

Autosleep works perfectly. Cheers

Nick

#43
oswaldini

oswaldini

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 144 posts
  • Gender:Male
  • Location:Cracow, Poland
Doesn't work for me. My machine goes to sleep by menu-command and wake without problems.

My DVD-RW is TSSTcorp CD/DVDW SH-S182M

#44
KWS

KWS

    InsanelyMac Protégé

  • Donators
  • 76 posts

Doesn't work for me. My machine goes to sleep by menu-command and wake without problems.

My DVD-RW is TSSTcorp CD/DVDW SH-S182M

I changed the basic script a little for some diagnostic messages. So when you download SleepTest and start it, you should see dialog boxes - one by one - with
1. Sleeptime (from System Preferences)
2. Idle time (time since last user input)
3. Time till sleep
For testing a short sleep time interval (maybe 2 min) is recommended. SleepTest must have focus to see dialog boxes.
And you must stop the script after testing manually :P
Attached File  SleepTest.app.zip   32.1KB   86 downloadsAttached File  RIP3s.app.zip   28KB   90 downloads

#45
oswaldini

oswaldini

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 144 posts
  • Gender:Male
  • Location:Cracow, Poland
RIP3s work perfect with my TSSTcorp CD/DVDW SH-S182M (IDE) on P5Q Pro !!

Thanks very much !!

#46
Sidewinder33

Sidewinder33

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 129 posts
  • Gender:Male
  • Location:Everett, WA
Hey I had a question about the script. Im not a programer at all. The script is working pretty good, goes to sleep on time like clockwork. One thing I've started noticing is that after it goes to sleep via the script, my computer once out of every 3 or 4 times shuts off after an extended period of time. I was wondering if something in the script may cause this or if its just my system acting up? Other than that I love the script, but my alarmclock not going off is killin me hahaha. Thanks for any insight or help in advance.

#47
KWS

KWS

    InsanelyMac Protégé

  • Donators
  • 76 posts

Hey I had a question about the script. Im not a programer at all. The script is working pretty good, goes to sleep on time like clockwork. One thing I've started noticing is that after it goes to sleep via the script, my computer once out of every 3 or 4 times shuts off after an extended period of time. I was wondering if something in the script may cause this or if its just my system acting up? Other than that I love the script, but my alarmclock not going off is killin me hahaha. Thanks for any insight or help in advance.

You can open Applescript-Editor and paste

tell application "System Events" to sleep

and click Run.
After that command the script is not responsible for further actions (in my knowledge). In Windows the System will go after a defined time to deep sleep (if set so), but in OS X ... ?

#48
Sidewinder33

Sidewinder33

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 129 posts
  • Gender:Male
  • Location:Everett, WA
Hmmm odd indeed, has anyone else had this same problem? I've recently updated some kexts but nothing to do with sleep. I'll keep testin to see if I figure anything out.

EDIT:
So I switched from OSXResart.kext to evoreboot.kext and haven't had an issue since I'll update again if anything else develops.

#49
KWS

KWS

    InsanelyMac Protégé

  • Donators
  • 76 posts

great work, Thanks.
Hope the future release can monitor disk activities like file coping, downloading etc.

Updated in first post ... :wallbash:

#50
Phorte

Phorte

    InsanelyMac Protégé

  • Members
  • PipPip
  • 80 posts
  • Gender:Male
  • Location:Adelaide, Australia
all you guys are lucky :( i can't even get manual sleep to work on my EX58A-UD3R :(

#51
d00d

d00d

    InsanelyMac Sage

  • Members
  • PipPipPipPipPipPip
  • 477 posts
  • Gender:Male
  • Location:41.648324, -70.635260

all you guys are lucky :( i can't even get manual sleep to work on my EX58A-UD3R :(

Luck has nothing to do with it, you need to use a modified DSDT.
There is no such thing as a EX58A-UD3R, it's either a EX58-UD3R or a X58A-UD3R.

#52
aleister Crowley

aleister Crowley

    InsanelyMac Protégé

  • Members
  • PipPip
  • 76 posts
Thank you for the Script !! It fixed my "Auto" Sleep Problem since i use Paragon NTFS v8 :) Manual Sleep/Wake is Rockstable.

I use your RIP3lan Script and it works fine while Lan Streaming of Movies too .

Autosleep works fine without Paragon NTFS. As soon i install the Paragon NTFS Driver Auto Sleep is broken.
The Script works perfectly fine on Snow Leopard 10.6.5 and my Asus P7P55LX with DSDT.

#53
User_01

User_01

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 264 posts
Thanks. RIP3lan works, here.

#54
miliuco

miliuco

    InsanelyMac Sage

  • Donators
  • 396 posts
  • Gender:Male
  • Location:Spain
Thank you very much KWS, RIP3lan is working for me also.

Do you think it's a good idea to set in the script

set systemSleepDelay to ((systemSleepDelay * 60) - 1)

so the script always takes place before scheduled system sleep?

#55
KWS

KWS

    InsanelyMac Protégé

  • Donators
  • 76 posts

Thank you very much KWS, RIP3lan is working for me also.

Do you think it's a good idea to set in the script

set systemSleepDelay to ((systemSleepDelay * 60) - 1)

so the script always takes place before scheduled system sleep?

You can change it, but in my case (wrong dvd-drive) it doesn't matter ... :help:
I think this on idle event is checked every 30 s from system, so it's possible that one check is 2 s before scheduled system sleep and the next (last) is 28 after, so this may be anyway not the exact moment when the the script triggers ...

#56
The Real Deal

The Real Deal

    InsanelyMac Legend

  • Donators
  • 930 posts
  • Gender:Male
  • Location:France
Hello,

Is this script usable as a third party app? I use hardware monitor and with monitoring ability i can call a 3rd app to launch if CPU overheating per example. Suppose i set hardware monitor to call your script to put the computer in sleep mode when CPU is over 75 degres. OK or KO ?

In fact i have already done a shutdown script but there is some resistant programs, even mail sometimes prevents from sleep/shutdown.

Thanks.

#57
KWS

KWS

    InsanelyMac Protégé

  • Donators
  • 76 posts
If i understand your question you need only the line

tell application "System Events" to sleep

open AppleScript editor, paste this line, save the script anywhere and call it from hardware monitor ...

#58
The Real Deal

The Real Deal

    InsanelyMac Legend

  • Donators
  • 930 posts
  • Gender:Male
  • Location:France
thanks for the fast reply, will test this solution.

#59
miliuco

miliuco

    InsanelyMac Sage

  • Donators
  • 396 posts
  • Gender:Male
  • Location:Spain
My DVD drive is Optiarc DVD RW AD-7240S.

The script puts the PC to sleep perfectly.
It checks AppleFileServer activity (refered to file transfer in the LAN).
For Finder activity and local file transfers it's the same.
But it doesn't check the network activity, for example when Safari is downloading. If I add Safari to the sleep-resistants apps, it works as expected but the computer doesn't go to sleep when Safari's downloads are finished (Safari remains opened).

It would be nice to check if Safari's cpu load is greater than 2% (for example). I've tried to duplicate the text of the script containing the references to AppleFileServer and the Finder but it doesn't work:

set Prog3 to do shell script ("ps auxww | grep '[/]" & "Safari" & "'" & " | 
grep '" & "root" & "' | awk '{print $2}'")
		if Prog3 is greater than 0 then
			set cpu_usage to (do shell script ("ps -c -o %cpu='' -p " & Prog3)) as integer
			if cpu_usage > 2 then
				return
			end if
		end if

This code doesn't prevent RIP to put the computer to sleep if Safari is downloading some file with a cpu usage greater than 2%.

(Sorry my english).

#60
KWS

KWS

    InsanelyMac Protégé

  • Donators
  • 76 posts
It seems that Safaris cpu-usage increases with more tabs open or with certain pages (probably with more ads, more background connectivity, preloading or something). So in some cases the script will stop (that means no sleep) without a running download .... :)

So try this one, i hope it will not trigger to early ...







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy