Re: Accessing "where from" property of a downloaded file
Re: Accessing "where from" property of a downloaded file
- Subject: Re: Accessing "where from" property of a downloaded file
- From: Laine Lee <email@hidden>
- Date: Sat, 13 Sep 2008 01:53:51 -0500
- Thread-topic: Accessing "where from" property of a downloaded file
Title: Re: Accessing "where from" property of a downloaded file
On Sep 12, 2008, at 11:49 PM, Behrang Saeedzadeh wrote:
>Hi all,
>
>Is it possible to access the "where from" property of a file, which
>shows from what url it is downloaded from?
Here's one I use as the source of an Automator Finder plug-in workflow. Puts it into the Spotlight comments.
Old style.
on run {input}
repeat with n in input
set z to (n as alias)
set n to (info for z)'s name
tell application "Finder" to set P to z's container as alias
set zP to (quoted form of (POSIX path of (P as text) & n))
try
set the_URL to do shell script "mdls -name kMDItemWhereFroms" & space & zP & space & "|" & space & "grep -o '\"'.*'\"'"
set the_URL to replace_chars(the_URL, "\"", "")
tell application "Finder"
set comment of file ((P as text) & n) to the_URL
end tell
end try
end repeat
end run
on replace_chars(this_text, wrongo, righto)
set AppleScript's text item delimiters to the wrongo
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the righto as string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars
Laine Lee
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden