Re: getting the user's download folder
Re: getting the user's download folder
- Subject: Re: getting the user's download folder
- From: Paul Skinner <email@hidden>
- Date: Thu, 10 Apr 2003 21:00:43 -0400
On Thursday, April 10, 2003, at 05:57 PM, John Delacour politely wrote
me off-list:
At 2:38 pm -0400 10/4/03, Paul Skinner wrote:
This is much more robust. I think this should work consistently.
UsersDownloadFolder() --> "titan:Users:paul:Downloads:"
-- .....
set hexDiskName to (text 3 thru (((text 1 thru 2 of iConfigData) as
number)
end UsersDownloadFolder
Try that with a disk named "Chrysanthemum" :-)
Grrrrr... Me and my ten-fingered bias for decimal!
I knew that was too easy. Here's the next duck for the shooting
gallery. Anyone with their Download folder on a remote Windows server?
: )
UsersDownloadFolder()
-->"Chrysanthemumaximuma:FolderName:SubFolderName:DownloadFolder:"
on UsersDownloadFolder()
set AppleScript's text item delimiters to "<"
set {iConfigData, AppleScript's text item delimiters} to {text item 2
of (do shell script "defaults read com.apple.internetconfig | grep -A 1
DownloadFolder"), ">"}
set {iConfigData, AppleScript's text item delimiters} to {text item 1
of iConfigData, " "}
set {iConfigData, AppleScript's text item delimiters} to {text items
of iConfigData, ""}
set iConfigData to iConfigData as text
set hexDiskName to (text 3 thru ((((offset of (character 1 of
iConfigData) in "0123456789abcdef") - 1) * 10 + ((offset of (character
2 of iConfigData) in "0123456789abcdef") - 1)) * 2) of iConfigData)
set AppleScript's text item delimiters to hexDiskName
set {iConfigData, AppleScript's text item delimiters} to {item 4 of
(text items of iConfigData), "00"}
set {iConfigData, AppleScript's text item delimiters} to {text item 1
of iConfigData, ""}
set DownloadFolderpath to (do shell script "echo " & hexDiskName &
iConfigData & " | perl -ple's/([0-9a-fA-F]{2})/chr(hex($1))/ge' ") & ":"
set {text:plainText} to (text of DownloadFolderpath) as text
return plainText
end UsersDownloadFolder
Paul Skinner
_______________________________________________
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.