简体   繁体   English

将徽章刷新到 Finder 中的文件图标

[英]refresh badges to file icons in Finder

I done Icon overlay in OS X and I just need to update the overlay icon when it's status changed.我在 OS X 中完成了图标覆盖,我只需要在状态改变时更新覆盖图标。 I tried many techniques, but it don't works.我尝试了很多技术,但都行不通。 I don't need to restart the finder, I just want to update the badge icon of specific file.我不需要重新启动finder,我只想更新特定文件的徽章图标。

For this case I tried some ways.对于这种情况,我尝试了一些方法。

  1. Just touch and remove the file, it would trigger the refresh the finder.只需触摸并删除文件,它就会触发刷新查找器。

  2.  [[NSWorkspace sharedWorkspace] selectFile:path inFileViewerRootedAtPath:nil];

    It works well but it also open the finder window when it is not active.( shall we have any option to do not open the finder window here)它运行良好,但它在不活动时也会打开取景器窗口。(我们是否可以选择不在这里打开取景器窗口)

Apart from above two ways, I need any optimised way to refresh the File's badge icon in finder除了以上两种方式,我需要任何优化的方式来刷新 finder 中文件的徽章图标

try
  tell application "Finder"
    set a to get the bounds of the front window
    set b to get the bounds of the front window
    set bound to (item 3 of a) + 1
    set item 3 of a to bound
    set bounds of the front window to a
    set bounds of the front window to b
  end tell
  return a
on error msg number num
--display dialog "Unable to launch " & msg & " (" & (num as text) & ")"return msg
    return msg
end try

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM