我想在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