2015-08-28 61 views
4

我嘗試了很多很多的場景來製作一個腳本,它會提高音量而沒有成功。這裏例如:Spotify - 音量 - AppleScript API

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 

要調試我使用COMMANDE「SAY音量」不同的步驟之後,我發現,值停留在相同的值,他得到的第一個時間。它將「重置」它的唯一方法是按暫停/播放。每當我暫停/播放「音量」時,都會獲得新的值並且修改一次,直到我暫停/再次播放。

在這裏,我尋求幫助:https://forum.keyboardmaestro.com/

,他們說我應該將此情況報告給Spotify的。在spotify上,我正在尋找我應該報告的內容,並且表示沒有任何開發者要在這裏發佈信息。所以我在這裏。

所以我的問題是:

我是談論這個bug正確的地方?

and

有沒有人有解決方案?

回答

3

看起來你已經在別處問過這個問題了,可能已經找到了答案:在Spotify的某些版本中這被打破了,但你所擁有的基本上是正確的。

我已經將它擴展到下面,至少在v1.0.20.94.g8f8543b3中,如果您將其設置爲大於100的值,則該卷將包裝爲0.同樣,如果嘗試將其設置爲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 
+0

謝謝你這麼多 –

+0

@JonathanM。你非常歡迎! – sanmiguel

0

我還需要相反的。很明顯,但在這裏你去:)

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