Re: Alias Files
Re: Alias Files
- Subject: Re: Alias Files
- From: Philip Aker <email@hidden>
- Date: Sun, 3 Aug 2008 07:34:41 -0700
On 2008-08-03, at 02:03:27 , KOENIG Yvan wrote:
So I created version 1.0.1 of GetAliasTarget which uses those old
style functions. So if you can verify that you get the HFS path
using version 1.0.1, I think everyone should file a bug because
then there's some proof that it can be done.
Bingo.
With this script:
tell application "Finder"
set thePath to (the clipboard as «class furl») as text
set class_of_item to class of item thePath
if class_of_item is alias file then
try
set originalPath to original item of item thePath as text (* send
an error if the original file is not inline *)
on error
set originalPath to do shell script "/usr/local/bin/
GetAliasTarget " & quoted form of POSIX path of thePath
end try
else
set originalPath to thePath
end if
end tell
display dialog originalPath
and the new GetAliasTarget
I get the Posix path of an alias whose original file is on a missing
volume.
Here is the log.
tell application "Finder"
the clipboard as «class furl»
file "Macintosh
HD:Users:yvan_koenig:Desktop:pour_modifier_Numbers.zip"
get class of item "Macintosh
HD:Users:yvan_koenig:Desktop:pour_modifier_Numbers.zip"
alias file
get original item of item "Macintosh
HD:Users:yvan_koenig:Desktop:pour_modifier_Numbers.zip"
do shell script "/usr/local/bin/GetAliasTarget '/Users/yvan_koenig/
Desktop/pour_modifier_Numbers.zip'" "/Volumes/Sans titre/
pour_modifier_Numbers.zip"
end tell
tell current application
display dialog "/Volumes/Sans titre/
pour_modifier_Numbers.zip" {button returned:"OK"}
end tell
I am not sufficiently fluent with English to send a correct bug
report for such a thing :-(
What you have included in this post would be fine for a bug filed on
Finder scripting. I have sent a post to one of the Finder developers
informing him of the problem.
Since the new alias storage format worked for me both on 10.4 and 10.5
I'm wondering if you created those aliases back in 10.3 or earlier or
with a tool that stored those aliases in the old format? That could be
a factor in this problem.
PS: This GetAliasTarget tool is currently not guaranteed to give you a
correct trailing colon for aliases which target folders. That's
something you may have to watch out for in scripting code.
Philip Aker
echo email@hidden@nl | tr a-z@. p-za-o.@
Democracy: Two wolves and a sheep voting on lunch.
_______________________________________________
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