py-appscript 需要参数
我想制作一个Python脚本来控制VLC。 VLC 可以通过 AppleScript 进行控制,并使用 py-appscript
我可以运行 AppleScript 代码来自Python。
使用AppleScript我可以通过以下方式播放/暂停VLC
tell application "VLC" to play
这等于py-appscript
中的以下内容
app('VLC').play()
我还应该能够通过以下方式跳到下一个曲目:
app('VLC').next()
但是这样做时我收到以下Python错误:
Traceback (most recent call last):
File "vlclib.py", line 25, in <module>
app('VLC').next()
TypeError: next() takes exactly 2 arguments (1 given)
有人吗知道为什么我会收到此错误吗?上面的代码在 AppleScript 中应该等于以下代码,它可以完美运行:
tell application "VLC" to next
I want to make a Python script to control VLC. VLC can be controlled through AppleScript and by using py-appscript
I can run AppleScript code from Python.
Using AppleScript I can play/pause VLC by
tell application "VLC" to play
This equals to the following in py-appscript
app('VLC').play()
I should also be able to skip to next track by:
app('VLC').next()
But when doing so I get the following Python error:
Traceback (most recent call last):
File "vlclib.py", line 25, in <module>
app('VLC').next()
TypeError: next() takes exactly 2 arguments (1 given)
Does anyone know why I get this error? The above code should equal the following in AppleScript which works perfectly:
tell application "VLC" to next
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 appscript 文档:
由于
next
是保留关键字,您可以通过运行来修复此问题From the appscript documentation:
As
next
is a reserved keyword, you can fix this by running