Re: path to user's folder
Re: path to user's folder
- Subject: Re: path to user's folder
- From: John Baltutis <email@hidden>
- Date: Sun, 20 Apr 2003 00:27:11 -0700
I wrote:
On 4/20/03, David Hood <email@hidden> wrote:
>
>
> Report the name of the user's folder, which is in the mounted server volume,
>
Well that bit should be fairly easy, for a start I'd try
>
>
tell application "Finder"
>
set homepath to home as string
>
end tell
>
set nameOfUser to extractFromEnd(homepath, 1, ":")
>
return nameOfUser
>
>
on extractFromEnd(stringToExtract, placesBack, usingBreak)
>
set savedTextItemDelimiters to AppleScript's text item delimiters
>
set AppleScript's text item delimiters to usingBreak
>
set stringAsList to every text item of stringToExtract
>
set listCount to number of items in stringAsList
>
set desiredItem to listCount - placesBack
>
set AppleScript's text item delimiters to savedTextItemDelimiters
>
return item desiredItem of stringAsList
>
end extractFromEnd
>
This is easier:
tell application "Finder" to set PathToUser to home as string
set User to word -1 of PathToUser
User
However, this is better
set User to word -1 of ((path to "cusr") as string)
User
_______________________________________________
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.