Re: Alias Files
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