在applescript中将音量增加1

在applescript中将音量增加1,applescript,volume,Applescript,Volume,我试图复制音量键的功能,但在applescript中。但是我不能让它工作。“增大音量”按钮将音量设置为最大,而“减小音量”按钮也会这样做。有人知道我做错了什么吗?这是我的密码: -- increase volume on increaseVolumeHandler_(sender) tell application "finder" set theOutput to output volume of (get volume settings) set volume ou

我试图复制音量键的功能,但在applescript中。但是我不能让它工作。“增大音量”按钮将音量设置为最大,而“减小音量”按钮也会这样做。有人知道我做错了什么吗?这是我的密码:

-- increase volume

on increaseVolumeHandler_(sender)
    tell application "finder"
    set theOutput to output volume of (get volume settings)
    set volume output volume (theOutput + 6.25)
    end tell
    do shell script "afplay /System/Library/Sounds/Pop.aiff"
end increaseVolumeHandler_

-- decrease volume

on decreaseVolumeHandler_(sender)
    tell application "finder"
    set theOutput to output volume of (get volume settings)
    set volume output volume (theOutput - 6.25)
    end tell
    do shell script "afplay /System/Library/Sounds/Pop.aiff"
end decreaseVolumeHandler_

这些功能在10.7.5版上对我有效,你在试用什么OSX版本

您还可以删除发送方参数和tell finder块的冗余代码,例如

on increaseVolumeHandler_()
    set theOutput to output volume of (get volume settings)
    set volume output volume (theOutput + 6.25)
    do shell script "afplay /System/Library/Sounds/Pop.aiff"
end increaseVolumeHandler_

这些功能在10.7.5版上对我有效,你在试用什么OSX版本

您还可以删除发送方参数和tell finder块的冗余代码,例如

on increaseVolumeHandler_()
    set theOutput to output volume of (get volume settings)
    set volume output volume (theOutput + 6.25)
    do shell script "afplay /System/Library/Sounds/Pop.aiff"
end increaseVolumeHandler_

谢谢,出于某种原因,是tell block导致了问题。谢谢,出于某种原因,是tell block导致了问题。