【问题标题】:Spotify - sound volume - AppleScript APISpotify - 音量 - AppleScript API
【发布时间】:2015-11-23 06:57:34
【问题描述】:

我尝试了很多很多场景来制作一个提高音量但没有成功的脚本。这里的例子:

tell application "System Events"
    set MyList to (name of every process)
end tell
if (MyList contains "Spotify") is true then

    tell application "Spotify"
        set volcheck to get sound volume
        set volcheck to (volcheck + 10)
        set sound volume to volcheck    
    end tell

end if

或:

tell application "System Events"
    set MyList to (name of every process)
end tell

if (MyList contains "Spotify") is true then

tell application "Spotify"
    set sound volume to (sound volume + 10) 
end tell

end if

为了调试,我在不同的步骤后使用了命令“说音量”,我发现该值停留在他第一次获得的相同值上。它会“重置”它的唯一方法是按下暂停/播放。每次我暂停/播放“音量”时,都会获取新值并进行一次修改,直到我再次暂停/播放。

在这里寻求帮助:https://forum.keyboardmaestro.com/

他们说我应该把这个报告给 spotify。在 spotify 上,我正在寻找我应该在哪里报告这个并且它说没有开发人员在这里发布。所以我来了。

所以我的问题是:

我是谈论这个错误的合适地方?

有人有解决办法吗?

【问题讨论】:

    标签: applescript spotify spotify-app spotify-desktop


    【解决方案1】:

    您似乎在其他地方问过这个问题,并且可能已经找到了答案:这在某些版本的 Spotify 中被破坏了,但您所拥有的基本上是正确的。

    我在下面扩展了它,因为(至少在 v1.0.20.94.g8f8543b3 中)如果您将其设置为高于 100 的值,则音量将回绕为 0。同样,如果您尝试设置,它将回绕至 100它低于 0。

    tell application "Spotify"
        set currentvol to get sound volume
        -- volume wraps at 100 to 0
        if currentvol > 90 then
            set sound volume to 100
        else
            set sound volume to currentvol + 10
        end if
    end tell
    

    【讨论】:

      【解决方案2】:

      我也需要相反的东西。很明显,但是给你:)

      tell application "Spotify"
          set currentvol to get sound volume
          -- volume wraps at 100 to 0
          if currentvol < 10 then
              set sound volume to 0
          else
              set sound volume to currentvol - 10
          end if
      end tell
      
      end alfred_script
      

      (我正在制作a workflow for Alfred3

      【讨论】:

        猜你喜欢
        • 2012-06-05
        • 1970-01-01
        • 2012-07-21
        • 2012-02-12
        • 2012-01-23
        • 1970-01-01
        • 2014-06-11
        • 1970-01-01
        • 2011-06-26
        相关资源
        最近更新 更多