查找更新/刷新AppleScript的10.8不工作 [英] Finder update/refresh applescript not working in 10.8

查看:171
本文介绍了查找更新/刷新AppleScript的10.8不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用苹果脚本更新显示在取景器的文件和文件夹。这简化了脚本的版本:

I have been using apple script for updating display for files and folders in finder. This is simplified version of that script:

tell application "Finder"
    tell window 1 to update items
end tell

我可以看到,自10.8(山狮)更新命令没有正确执行或根本没有执行。直到10.8一切工作完美 - 更新命令后,立即所有图标得到重绘。
我用这个用于显示图标覆盖。

I can see that since 10.8 (Mountain Lion) update command is not properly executed or is not executed at all. Until 10.8 everything was working perfectly - Immediately after update command all icons got redrawn. I use this for showing overlay icons.

有任何你遇到过同样的问题?
我责怪取景器已经改变苹果脚本API,因为,如果我触摸-a -m文件,它就会被更新。所以可以肯定的是某种方式来更新它。

Have any of you encountered same problem? I blame finder having changed apple script api, because, if I touch -a -m file, it gets updated. So there is for sure some way to update it.

推荐答案

您可以创建可见在Finder中的文件刷新Finder窗口。

You can create visible file in finder to refresh finder window.

tell application "Finder"
    set currentPath to (POSIX path of (target of front window as alias))
    set filePath to currentPath & "UUID" --create UUID
    do shell script "touch \"" & filePath & "\""
    delay 0.5
    do shell script "rm \"" & filePath & "\""
end tell

这篇关于查找更新/刷新AppleScript的10.8不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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