Objective c applescript未设置图标图像(El Capitan)
这个问题是本报告的继续 提供的解决方案适用于High Sierra,但不适用于El Capitan。没有为别名设置图标。是否需要进行任何更改以使其也适用于El Capitan 如果是,请提供代码片段 说到applescript,我是一个完全的新手,所以我不知道为什么它不起作用 这是我的密码Objective c applescript未设置图标图像(El Capitan),objective-c,applescript,alias,osx-elcapitan,macos-mojave,Objective C,Applescript,Alias,Osx Elcapitan,Macos Mojave,这个问题是本报告的继续 提供的解决方案适用于High Sierra,但不适用于El Capitan。没有为别名设置图标。是否需要进行任何更改以使其也适用于El Capitan 如果是,请提供代码片段 说到applescript,我是一个完全的新手,所以我不知道为什么它不起作用 这是我的密码 use framework "Foundation" use scripting additions set ideContentsPath to ".../IDE/WebOSIDE.app/Contents
use framework "Foundation"
use scripting additions
set ideContentsPath to ".../IDE/WebOSIDE.app/Contents" -- path of Contents folder which i replace at runtime from my java program
set ideExec to ideContentsPath & "/MacOS/WebOSIDE"
set sourceFile to (POSIX file ideExec)
tell application "Finder"
set newAlias to (make new alias file at desktop to sourceFile) as alias
set iconPath to ideContentsPath & "/Resources/WebOSIDE.icns"
my setIcon(newAlias,iconPath)
set name of newAlias to "My Shortcut"
duplicate newAlias to folder "my Dir" of folder "Applications" of startup disk
end tell
to setIcon(fileRef,iconPath)
set iconImage to current application's NSImage's alloc's initWithContentsOfFile:iconPath
current application's NSWorkspace's sharedWorkspace's setIcon:iconImage forFile:(POSIX path of fileRef) options:0
end setIcon