iTunes Fade

Posted on
Thu Feb 10, 2011 12:07 pm
Korey online
User avatar
Posts: 213
Joined: Jun 04, 2008
Location: Las Vegas, NV

iTunes Fade

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

Posted on
Thu Feb 10, 2011 2:39 pm
jay (support) offline
Site Admin
User avatar
Posts: 8881
Joined: Mar 19, 2008
Location: Austin, Texas

Re: iTunes Fade

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!

Jay (Indigo Support)
Twitter | Facebook

Posted on
Fri Feb 11, 2011 10:38 am
Korey online
User avatar
Posts: 213
Joined: Jun 04, 2008
Location: Las Vegas, NV

Re: iTunes Fade

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!
Attachments
Screen shot 2011-02-11 at 10.32.49 AM.png
Screen shot 2011-02-11 at 10.32.49 AM.png (70.9 KiB) Viewed 1452 times

Posted on
Fri Feb 11, 2011 11:02 am
jay (support) offline
Site Admin
User avatar
Posts: 8881
Joined: Mar 19, 2008
Location: Austin, Texas

Re: iTunes Fade

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

Jay (Indigo Support)
Twitter | Facebook

Posted on
Fri Feb 11, 2011 12:34 pm
Korey online
User avatar
Posts: 213
Joined: Jun 04, 2008
Location: Las Vegas, NV

Re: iTunes Fade

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!

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest