• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Out of Control Aliases?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Out of Control Aliases?


  • Subject: Re: Out of Control Aliases?
  • From: Shane Stanley <email@hidden>
  • Date: Thu, 04 Oct 2012 10:11:36 +1000

On 04/10/2012, at 9:30 AM, Christopher Stone <email@hidden> wrote:

Since when has an alias file been 2.3 Megabytes????!!!!

I think the big change was made in 10.6. Alias files are now actually bookmark files (those things that now get passed to open handlers). They include a resource fork that holds two custom preview icons. (Play with ls -@l.) As you've probably noticed, icons have become a lot bigger these days.

When I last looked, the two icons were identical. Curiously, if you make an alias using the code for making bookmarks, they contain the icon only once, so they are much smaller -- yet as far as I can see the files behave identically. But one icon might be used for high-res displays now -- I haven't checked.

I actually use that in ASObjC Runner's "manage file ... with creating alias" command, so you can play with it yourself. Or you can use the longer version to see what's happening:

script makeAlias
set thePath to current application's NSApp's passedValue() as text -- get passed path
set originalURL to current application's NSURL's fileURLWithPath_(thePath) -- make NSURL of it
set aliasURL to current application's NSURL's fileURLWithPath_(thePath & " alias") -- make NSURL for alias
-- build bookmarkData
set bookmarkData to originalURL's bookmarkDataWithOptions_includingResourceValuesForKeys_relativeToURL_error_(current application's NSURLBookmarkCreationSuitableForBookmarkFile, missing value, missing value, missing value)
-- write it to file
set theResult to current application's NSURL's writeBookmarkData_toURL_options_error_(bookmarkData, aliasURL, 0, missing value)
end script

set thePosixPath to POSIX path of (choose file)
tell application id "au.com.myriad-com.ASObjC-Runner" -- ASObjC Runner.app
run the script {makeAlias} passing thePosixPath
end tell

There is another option, NSURLBookmarkCreationMinimalBookmark, but it doesn't seem to make things any smaller.

-- 
Shane Stanley <email@hidden>
'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Out of Control Aliases?
      • From: Christopher Stone <email@hidden>
  • Prev by Date: Re: Referencing a Message in Mail 6.1 - Huh?
  • Next by Date: Re: AppleScript-Users Digest, Vol 9, Issue 393
  • Previous by thread: FaceSpan Null error
  • Next by thread: Re: Out of Control Aliases?
  • Index(es):
    • Date
    • Thread