In article <joshuafwhalen-C515A8.19283301052008@[EMAIL PROTECTED]
>,
Joshua Whalen <joshuafwhalen@[EMAIL PROTECTED]
> wrote:
> get the sound volume
> if result > 1 then
> set MyVol to the result
> else
> if result < 5 then
> exit repeat
> end if
> end if
There's no reason to get the volume to a variable, subtract 1 from to
the variable, and set the volume to the variable. Really, the whole
fadeout bit would be lot simpler as:
tell application "iTunes"
repeat with v from its sound volume to 0 by -1
set its sound volume to v
end repeat
set its sound volume to 0
end tell
Much simpler.
Similarly, the fadeup could be:
tell application "iTunes"
repeat with v from its sound volume to 100 by 10
set its sound volume to v
end repeat
set its sound volume to 100
end tell
Note that if you don't say "its sound volume" but rather "sound
volume," you will be affecting the system volume, not iTunes' ("sound
volume" is in a scripting addition and takes precedence over iTunes'
built-in terminology).
Also note that I explicitly set the sound volume to the minimum or
maximum after the loop, in case the loop doesn't take it all the way to
the top or the bottom of the scale as appropriate, as can happen when
you are stepping by 3 or whatever.
You can change the "by" to make it go faster. If you need it to go
slower than 1 in either direction, you will need to insert a delay in
the repeat loop, like the "delay 0.1" you had in your example.
It might also be easier to just tell iTunes to "play playlist item 1 of
argv" rather than having a bunch of if clauses that do basically the
same thing.
--
Jerry Kindall, Seattle, WA <http://www.jerrykindall.com/>
Send only plain text messages under 32K to the Reply-To address.
This mailbox is filtered aggressively to thwart spam and viruses.


|