py-appscript 正在启动一个新的 Finder 实例 [英] py-appscript is starting a new Finder instance

查看:26
本文介绍了py-appscript 正在启动一个新的 Finder 实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 py2app 应用程序,它使用 py-appscript 运行一个 appscript.Applescript 代码是这一行:

i have a py2app application, which runs an appscript using py-appscript. the Applescript code is this one line:

app('Finder').update(<某个文件的文件别名>)

这通常会在 Finder 中更新文件的预览.除了 Leopard 之外,它大部分时间都有效.在 Leopard 中,每次执行该脚本时,它不会更新文件,而是启动 Finder 的一个新实例.我究竟做错了什么?该应用是在同一台机器上构建的(Leopard).

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).

推荐答案

鉴于 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.

这篇关于py-appscript 正在启动一个新的 Finder 实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆