Page 1 of 1

iTunes Fade

PostPosted: Thu Feb 10, 2011 12:07 pm
by Korey
I use this script when putting the house to sleep at night, if music is playing it will gradually fade out over time, then stop iTunes and reset the volume to your regular level.

Stole most of it from Doug's AppleScripts: http://dougscripts.com/itunes/

-------

property tick : 1 -- change volume level by this many each loop
property thismany : 30 -- seconds to wait before making next change to volume
tell application "iTunes"
    repeat
        set snd to sound volume
        if snd is less than or equal to tick then
            set sound volume to 0
            exit repeat
        end if
        set sound volume to (snd - tick)
        delay thismany
    end repeat
    stop
end tell

tell application "iTunes"
    stop
    set snd to sound volume
    set sound volume to 40
end tell

Re: iTunes Fade

PostPosted: Thu Feb 10, 2011 2:39 pm
by jay (support)
You'll want to make sure you run it as an external script - if it's embedded it'll hang up the server until it's finished running. Cool script, thanks!

Re: iTunes Fade

PostPosted: Fri Feb 11, 2011 10:38 am
by Korey
jay wrote:
You'll want to make sure you run it as an external script - if it's embedded it'll hang up the server until it's finished running.


Never thought of that! and of course trying to compile it in script editor give me errors.. :?:

Any applescript experts have any suggestions why I am getting this error in script editor and not when its compiled in Indigo as an embedded script?

Thanks!

Re: iTunes Fade

PostPosted: Fri Feb 11, 2011 11:02 am
by jay (support)
From what I can see, it looks like your copy/paste didn't quite work - this line seems to be missing:

Code: Select all
if snd is less than or equal to tick then

Re: iTunes Fade

PostPosted: Fri Feb 11, 2011 12:34 pm
by Korey
jay wrote:
From what I can see, it looks like your copy/paste didn't quite work - this line seems to be missing:

Code: Select all
if snd is less than or equal to tick then



Boy do I feel dumb, :oops: Thanks Jay!