我想在Finder应用程序中刷新特定文件/文件夹的图标。如何刷新查找窗口?
FNNotifyByPath((const UInt8 *)folderPath, kFNDirectoryModifiedMessage, kNilOptions);
FNNotifyByPath
对此不起作用。 现在我使用AppleScript
+(void) refreshIconForItem : (NSString *)itemPath
{
NSString *source=[NSString stringWithFormat:@"tell application \"Finder\" to update \"%@\"",[NSString stringWithUTF8String:itemPath]];
NSAppleScript *update=[[NSAppleScript alloc] initWithSource:source];
NSDictionary *err;
[update executeAndReturnError:&err];
}
尝试,但这功能也不能正常工作。
任何人都可以帮我吗?
你有没有发现这个解决方案?请让我知道哪些脚本正在为此工作。因为我使用了几乎所有的脚本,但不会使用任何脚本。任何帮助表示赞赏..! – jigs 2015-10-28 11:47:45
@Jigar你可以使用http://stackoverflow.com/a/15541439/944634。 Finder刷新苹果脚本不能在10.8以上工作 – 2015-10-28 13:16:47