Re: getting the user's download folder WAS Re: can't get it to work
Re: getting the user's download folder WAS Re: can't get it to work
- Subject: Re: getting the user's download folder WAS Re: can't get it to work
- From: Paul Skinner <email@hidden>
- Date: Thu, 10 Apr 2003 14:38:43 -0400
On Thursday, April 10, 2003, at 11:12 AM, Reinhold Penner wrote:
Paul,
I hope you're happy, I got interested in this puzzle and it kept me
up late.
I'm deeply impressed!!! Very nice.
I wonder if this will even work on other boxes/versions. The format
of the ic-data in the plist is surely more easily used in a method
that I don't know about. Chris?
UsersDownloadFolder()
-->"DiskName:FolderName:SubFolderName:DownloadFolder:"
OMM it introduces a space before the final ":" like this:
"DiskName:FolderName:SubFolderName:DownloadFolder :"
-Reinhold
Oops! I'm glad you caught that. This is much more robust. I think this
should work consistently.
UsersDownloadFolder() --> "titan:Users:paul:Downloads:"
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 (((text 1 thru 2 of iConfigData) as
number) * 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.