• 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: How can I get the name of a deleted original item of an alias?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can I get the name of a deleted original item of an alias?


  • Subject: Re: How can I get the name of a deleted original item of an alias?
  • From: "S. J. Cunningham" <email@hidden>
  • Date: Mon, 31 Aug 2015 12:01:03 -0400

> On 31 Aug 2015, at 10:14 pm, S. J. Cunningham <email@hidden> wrote:
>>
>> How can I get the script to return the name of the original item if the file itself is missing? (Other than resorting to GUI Scripting).
>
> And to answer that part, I think I recall that you're using 10.6

Yes, you recall correctly :)  They will take my Snow Leopard when they pry my cold, dead fingers off the keyboard :)

> What is the label of the value it appears in when you get properties? I'm curious, because I don't see it -- just "original item:missing value".


I just checked again:  Set the original of an alias to a given file then delete that original file and the get info for the alias still shows the original file name.  However, the "original item" property shows "missing value".  I can't reproduce my original situation.  Strange.

Steve


> , but if I'm wrong, you can use this:
>
> use AppleScript version "2.3.1"
> use scripting additions
> use framework "Foundation"
>
> on nameOfOriginalFileForAlias:posixPath
> 	tell current application's class "NSURL"
> 		-- make URL
> 		set anNSURL to its fileURLWithPath:posixPath
> 		-- load data from alias file
> 		set theData to its bookmarkDataWithContentsOfURL:anNSURL |error|:(missing value)
> 		-- get value as dictionary from data
> 		set theResult to its resourceValuesForKeys:{current application's NSURLLocalizedNameKey} fromBookmarkData:theData
> 	end tell
> 	-- extract name and coerce to text
> 	return (theResult's objectForKey:(current application's NSURLLocalizedNameKey)) as text
> end nameOfOriginalFileForAlias:
>
>
> --
> Shane Stanley <email@hidden>
> <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


 _______________________________________________
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


References: 
 >How can I get the name of a deleted original item of an alias? (From: "S. J. Cunningham" <email@hidden>)
 >Re: How can I get the name of a deleted original item of an alias? (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: How can I get the name of a deleted original item of an alias?
  • Previous by thread: Re: How can I get the name of a deleted original item of an alias?
  • Index(es):
    • Date
    • Thread