• 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: Alias Files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alias Files


  • Subject: Re: Alias Files
  • From: Luther Fuller <email@hidden>
  • Date: Sun, 3 Aug 2008 10:15:57 -0500

I just tried GetAliasTarget with this script (compiled as an application bundle) and it works.

tell application "Finder"
set selfRef to (path to me)
set localRef to (container of selfRef)
try
set aliasRef to (some alias file of localRef)
on error errText number errNr
"Alias does not exist"
display dialog the result buttons {"Cancel"} default button 1
end try
--
try
original item of aliasRef
on error errText number errNr
((item "GetAliasTarget" of folder "Resources" of folder "Contents" of selfRef) as alias) as text
(quoted form of POSIX path of the result) & space & (quoted form of POSIX path of (aliasRef as text))
do shell script the result
"Missing original item ..." & return & the result
display dialog the result
return
end try
--
display dialog (the result as text) & return & "Exists!"
end tell


The Finder's errText for a missing original item is ...
	Finder got an error: Can’t get original item of alias
	file "TARGET_FOLDER" of folder "Alias_TESTS" of
	folder "Desktop" of folder "lutherfuller" of
	folder "Users" of startup disk.

It should say something like ...
	Missing original item: "OS_X:Users:lutherfuller:Desktop:TARGET_FOLDER".

Then I could extract the path I need from the error message text.
(And display an intelligent dialog such as: "The disk "OS_X" is not mounted." or "You messed up real bad.")


_______________________________________________
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: Alias Files
      • From: Philip Aker <email@hidden>
References: 
 >Alias Files (From: Luther Fuller <email@hidden>)
 >Re: Alias Files (From: Neil Laubenthal <email@hidden>)
 >Re: Alias Files (From: KOENIG Yvan <email@hidden>)
 >Re: Alias Files (From: Luther Fuller <email@hidden>)
 >Re: Alias Files (From: KOENIG Yvan <email@hidden>)
 >Re: Alias Files (From: Philip Aker <email@hidden>)
 >Re: Alias Files (From: KOENIG Yvan <email@hidden>)
 >Re: Alias Files (From: Philip Aker <email@hidden>)
 >Re: Alias Files (From: KOENIG Yvan <email@hidden>)
 >Re: Alias Files (From: Philip Aker <email@hidden>)

  • Prev by Date: Re: Alias Files
  • Next by Date: Re: Photoshop CS3 : translate selection problem - possibly units?
  • Previous by thread: Re: Alias Files
  • Next by thread: Re: Alias Files
  • Index(es):
    • Date
    • Thread