更新POSIX文件Apple Script语法在Mac OS 10.10(Yosemite)中不起作用

时间:2015-07-09 07:46:00

标签: objective-c cocoa applescript osx-yosemite

我想在Finder应用程序中刷新特定文件/文件夹的图标。所以我需要刷新所选目录。

我正在尝试使用AppleScript:

NSString *source=[NSString stringWithFormat:@"tell application \"Finder\" to update POSIX file\"%@\"",[NSString stringWithUTF8String:itemPath]];
NSAppleScript *update=[[NSAppleScript alloc] initWithSource:source];
NSDictionary *err;
[update executeAndReturnError:&err];

但它不适用于Mac OS 10.10(优胜美地)。 请建议任何替代方案。

任何帮助都是适当的.. !!

1 个答案:

答案 0 :(得分:0)

夹具

如果你可以添加你得到的错误和itemPath值来理解它会有所帮助。

这适用于10.10.3:

set x to path to desktop
tell application "Finder" to update x