Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

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.

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
452 views
Welcome To Ask or Share your Answers For Others

1 Answer

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...