getting the user's download folder WAS Re: can't get it to work
getting the user's download folder WAS Re: can't get it to work
- Subject: getting the user's download folder WAS Re: can't get it to work
- From: Paul Skinner <email@hidden>
- Date: Thu, 10 Apr 2003 08:43:53 -0400
WAS
On Wednesday, April 9, 2003, at 10:14 PM, Reinhold Penner wrote:
snip
There's nothing like a good challenge (although the last one I posed
remains open (getting the user's download folder).
-Reinhold
I hope you're happy, I got interested in this puzzle and it kept me up
late.
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:"
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, ""}
repeat while iConfigData contains " "
set AppleScript's text item delimiters to " "
set {iConfigData, AppleScript's text item delimiters} to {text items
of iConfigData, ""}
set iConfigData to iConfigData as text
end repeat
set AppleScript's text item delimiters to "00"
set hexFolderName to text 3 thru -1 of (text item 1 of iConfigData)
set AppleScript's text item delimiters to hexFolderName
set {iConfigData, AppleScript's text item delimiters} to {text item 4
of iConfigData, "0e"}
set {iConfigData, AppleScript's text item delimiters} to {text item 1
of iConfigData, ""}
set DownloadFolder to (do shell script "echo " & hexFolderName &
iConfigData & " | perl -ple's/([0-9a-fA-F]{2})/chr(hex($1))/ge' ") & ":"
set {text:plainText} to (text of DownloadFolder) 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.