Re: get alias from ~/path
Re: get alias from ~/path
- Subject: Re: get alias from ~/path
- From: John Delacour <email@hidden>
- Date: Sat, 1 Mar 2003 13:34:16 +0000
- Mac-eudora-version: 6.0a8
At 11:53 pm -0700 28/2/03, Donald Hall wrote:
This seems to work on my machine. Is 'id' the right command to use?
There is also 'logname'.
You can get the path in one go by doing
(do shell script "cd;pwd") & "/"
or
POSIX path of (path to "cusr")
set fileName to "~/Documents"
getAlias(fileName)
on getAlias(f)
if f starts with "~" then
set f to (do shell script "cd;pwd") & text 2 through -1 of f
end if
return POSIX file f as alias
end getAlias
You have the line << "/" & (characters 2 thru -1 of pathName) as text" >>
It is not necessary to write "as text" or "as string" when you are
concatenating string+list in that order. It is also better to use
<<text x through y>>. The chain will take the class of the first
item .... cfr:
{1, 2} & 3
--> {1, 2, 3}
1 & {2, 3}
--> {1, 2, 3}
"1" & {2, 3}
--> "123"
1 & 2
--> {1, 2}
1 & "2"
--> {1, "2"}
"1" & 2
-->"12"
"!!!" & (path to "cusr")
--> "!!!dx:Users:jd:"
JD
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.