I was able to create an alias file in cocoa as Christina suggested. Now I want to change the Icon for the Alias. I tried without success.
Anyone can have a workaround ?
dim file as FolderItem = SpecialFolder.Desktop.TrueChild("32bit")
dim Bookmark as string = CFBookmarkMBS.CreateBookmarkData(file, CFBookmarkMBS.kCreationSuitableForBookmarkFile)
Dim s as string
dim AliasFile as FolderItem = SpecialFolder.Desktop.TrueChild("32bit.alias")
if CFBookmarkMBS.WriteBookmarkDataToFile(Bookmark, AliasFile, 0) then
dim e as CFErrorMBS = CFBookmarkMBS.lasterror
MsgBox "Failed: "+e.Description
// set the file's type and creator codes
if file.Directory = true then
AliasFile.MacType = "fribox"
AliasFile.MacCreator = "MACS"
AliasFile.MacCreator = AliasFile.MacCreator
//apply custom icon to Alias
Dim img as NSImageMBS
Dim p as Picture
p= New Picture(1024,1024)
//Icon set works for folders
//if NSWorkspaceMBS.setIcon(img,file,0) then
//// make the newly created file known to the Finder immediately
//s = "ALIAS_CREATED_SUCCESSFULLY"
//s = "ERROR_ALIAS_CREATION_FOR"
//don't works for Aliases
if NSWorkspaceMBS.setIcon(img,AliasFile,0) then
// make the newly created file known to the Finder immediately
s = "ALIAS_CREATED_SUCCESSFULLY"
s = "ERROR_ALIAS_CREATION_FOR" + " " + AliasFile.NativePath