Adjust OSX System Audio Volume in Python

后端 未结 1 1675
没有蜡笔的小新
没有蜡笔的小新 2021-01-15 02:42

I would like to adjust the system audio volume in OSX from a python script. This question about implementing keyboard shortcuts tells me how to do it in applescript, but I\

1条回答
  •  北海茫月
    2021-01-15 03:13

    Use appscript to control the StandardAdditions scripting addition set volume command:

    >>> from osax import *
    >>> import time
    >>> sa = OSAX()
    >>> for i in range(50):
    ...   sa.set_volume(i*2)
    ...   time.sleep(1)
    ... 
    >>> 
    

    0 讨论(0)
提交回复
热议问题