 |
 |
Emulating volume keys with AppleScripts
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2000
Location: Cambridge
Status:
Offline
|
|
Does any one know if there is a way to create AppleScripts that will increase and decrease the volume incrementally. I have an old keyboard for my iMac and like the size but wouldn't mind having the new volume feature of the new keyboards. If possible, I would write the scripts and then bind them to the function keys. I would like there to be only two scripts and not one for every major volume setting.
|
|
|
| |
|
|
|
 |
|
 |
|
RGS
|
|
Requires Jon's Commands OSAX.
Note: The small integer volume control pre-OS9.1 used to be 0-7. Now with OS9.1 it appears to be 0-8... can anyone else confirm this?
To increase the volume by increments of 1:
tell application "Finder"
set myVol to sound volume --Jon's Commands
if myVol is less than or equal to 7 then
set sound volume to myVol + 1
end if
end tell
To decrease the volume by increments of 1:
tell application "Finder"
set myVol to sound volume --Jon's Commands
if myVol is greater than or equal to 1 then
set sound volume to myVol - 1
end if
end tell
|
|
|
| |
|
|
|
 |
|
 |
|
RGS
|
|
Update: I'm not sure how long Sound Scripting (OS9.1) has been a MAC OS scripting addition but you can set the volume without having Jon's Commands. The scripts for the most part are the same.
To increase the volume by increments of 1:
tell application "Sound Scripting"
set myVol to sound volume
if myVol is less than or equal to 7 then
set sound volume to myVol + 1
end if
end tell
tell application "Sound Scripting" to quit
To decrease the volume by increments of 1:
tell application "Sound Scripting"
set myVol to sound volume
if myVol is greater than or equal to 1 then
set sound volume to myVol - 1
end if
end tell
tell application "Sound Scripting" to quit
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2000
Location: Cambridge
Status:
Offline
|
|
Wow! Thanks for the advice and the scripts. I've tried them both out and they work great!
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: May 2000
Location: Australia
Status:
Offline
|
|
Hey, great scripts RGS.
And if you want to make it beep so you know how loud it is:
after the last line, just put in beep. like this:
tell application "Sound Scripting" to quit
beep
It's not really needed, but some people like to know how loud they are making it. Just a personal preference for some people.
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Nov 1999
Location: Georgetown, Demerara, Guyana
Status:
Offline
|
|
Hi all,
Just wanted to note that, in addition to the excellent advice given by RGS above, there's yet another older 'FadeAway' scripting addition (OSAX) which apparently can also perform this task (and can even separately set the individual left/right channel levels). [See the earlier related Sound volumes thread in this Forum; note that its link to the 'FadeAway' OSAX is old, and should now instead be FadeAway.]
Regards,
--Paul
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |