Re: path to user's folder
Re: path to user's folder
- Subject: Re: path to user's folder
- From: John Delacour <email@hidden>
- Date: Sun, 20 Apr 2003 08:47:38 +0100
- Mac-eudora-version: 6.0a16
At 11:46 pm -0700 19/4/03, John Baltutis wrote:
> 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
Too verbose!
tell app "Finder" to set uUser to home's name
_______________________________________________
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.