Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'The Finder does this' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
The Finder does this
Authored by: Krioni on Jul 08, '04 05:57:40PM
The Finder can get the file: protocol URL of any object. Here's the AppleScript code to do it:

tell application "Finder" to get URL of ( item 1 of ( get selection ))
So, to do this from the command-line, you'd use:

osascript -e 'tell application "Finder" to get URL of ( item 1 of ( get selection ))'
You get the idea. Now, if you wanted to make a droplet AppleScript, you'd need to put this code into it:

on open someFiles
	tell application "Finder" to get URL of (item 1 of (someFiles))
end open
Now, this only handles one item. You could rework it to give a return-delimited list of file URLs for multiple items, but iCal only wants one item, right? The good thing about using the Finder is that it should do all the character-conversion for you. I think. :-)

[ Reply to This | # ]
The Finder does this
Authored by: Simon Andersen on Jul 09, '04 06:54:22AM
If I may just make a small addition. It'd be really handy to have the Finder put the URL in the clipboard for easy pasting into iCal. So here we go:

on open someFiles
tell application "Finder" to set the clipboard to (get URL of (item 1 of (someFiles)) as string)
end open

Save this as an application in Script Editor and put it in to Dock for easy drag-and-drop

[ Reply to This | # ]