I am creating an alias and setting an icon for that using the script below. The icon is being set for High Sierra but not on El Capitan.
I am totally new to Applescript, so no idea why this isn’t working for El Capitan.
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
I need a solution which works across El Capitan to High Sierra.