py-appscript 正在启动一个新的 Finder 实例
我有一个 py2app 应用程序,它使用 py-appscript 运行 appscript。 Applescript 代码如下一行:
app('Finder').update(<某个文件的文件别名>)
这通常会更新 Finder 中文件的预览。它在大多数情况下都有效,除了 Leopard 之外。在 Leopard 中,每次执行该脚本时,它不会更新文件,而是启动一个新的 Finder 实例。我做错了什么?该应用程序是在同一台机器(Leopard)上构建的。
i have a py2app application, which runs an appscript using py-appscript. the Applescript code is this one line:
app('Finder').update(<file alias of a certain file>)
What this normally does is update a file's preview in Finder. It works most of the time, except for Leopard. In Leopard, everytime that script is executed, instead of updating the file, it starts a new instance of Finder. What am I doing wrong? The app was built on the same machine (the Leopard).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
鉴于 py-appscript 是 python 和您通过 Applescript 编写脚本的应用程序之间的一层,我建议将该语句移植到纯 Applescript 并查看它是否在那里工作。首先,Applescript (以及仅您的声明)可能会出现很多问题,并且当错误发生时, py-appscript 之前的预期并不明显。
Seeing as how py-appscript is a layer between python and the application you are scripting via Applescript, I would suggest porting the statement to pure Applescript and see if it works there. There are a lot of things that can go wrong with Applescript (and your statement alone) to begin with and it's not obvious what is the expected before with py-appscript when an error occurs.