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


Click here to return to the 'Easy way to get URL' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Easy way to get URL
Authored by: jolinwarren on Jul 08, '04 11:26:57AM
Probably the easiest way to quickly get the file URL is to download FileUtilsCM. One of its many useful features it the ability to copy a file's URL. What's best is you can set which features you want to appear in the contextual menu, so it doesn't get crowded with things you never use.



[
Reply to This | # ]
The URL
Authored by: jolinwarren on Jul 08, '04 11:28:43AM

I don't know what happened because the URL looked fine in the preview. But here it is:

http://free.abracode.com/cmworkshop/



[ Reply to This | # ]
OnMyCommand
Authored by: jecwobble on Jul 08, '04 11:47:01AM

I use OnMyCommand from Abracode which could be used, too, I suppose. Perhaps something like this seudo code:

echo "file://" + {objectpath} | tr " " "%20" | pbcopy

I may try this when I get a chance and post real code at that time.



[ Reply to This | # ]
OnMyCommand
Authored by: markju on Jul 08, '04 12:47:32PM
tr won't do what you want it to, you'll have to use sed:
echo "file://" + {objectpath} | sed -e 's/ /%20/g' | pbcopy
(with a space between the '/')

[ Reply to This | # ]
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 | # ]
Easy way to get URL
Authored by: neroshaw on Jul 09, '04 11:40:46AM

THanks for the ideas. I'll have to try out OnMyCommandCM.

Or if not I could just put that URL-to-Clipboard Applescript in the Applescript Menu (I'm assuming, let me know if that wouldn't work).

I just know that by the time I get around to setting this up, the very next day, Apple will release a 0.0.1 update to iCal that adds drag-and-drop for files.

-ns



[ Reply to This | # ]