Have been Googling for hours with absolutely no luck. Decided to post here as a last resort. I'm trying to access setIcon:forFile:options:
of NSWorkspace's sharedWorkspace
. Take for example, the following code snippet:
set r to current application's NSWorkspace's sharedWorkspace's "setIcon:forFile:options:"
Upon execution of this snippet, the following error is thrown: Can't get current application's NSWorkspace's sharedWorkspace's "setIcon:forFile:options:". Access not allowed. (-1723)
. I have tried a number of different ways to circumvent this strange exception, but none have worked thus far. Any suggestions on how to proceed here would be very much appreciated.
Thanks.
The (single) literal string parameter makes no sense. The method has three parameters. Each colon represents one parameter. You have to specify an NSImage
instance, a string file path and an integer value as 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