已经完全没有运气了一个小时的谷歌搜索。决定在此发布帖子,作为最后的选择。我正在尝试访问setIcon:forFile:options:
的NSWorkspace's sharedWorkspace
。以下面的代码段为例:
set r to current application's NSWorkspace's sharedWorkspace's "setIcon:forFile:options:"
在执行此代码段时,引发以下错误:Can't get current application's NSWorkspace's sharedWorkspace's "setIcon:forFile:options:". Access not allowed. (-1723)
。我尝试了多种不同的方法来规避这种奇怪的异常,但是到目前为止,没有一种方法起作用。非常感谢您对如何进行此处操作提出任何建议。
谢谢。
(单个)文字字符串参数没有意义。 method具有三个参数。每个冒号代表一个参数。您必须将NSImage
实例,字符串文件路径和整数值指定为options
set theImage to current application's NSImage's alloc()'s initWithContentsOfFile:"/fullpath/to/image.icns"
set success to current application's NSWorkspace's sharedWorkspace's setIcon:theImage forFile:"/fullpath/to/file.ext" options:0