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

Web location files and dragging to the Terminal System
If you're like me, you drag files into the Terminal window regularly to get the full path of the file auto-magically inserted into your command line.

I was therefore surprised to find out that dragging a .webloc file (those files you create by dragging URLs from your browser onto the desktop) into a terminal window did not place the full path of the file into the command line. Rather, the web location stored in the .webloc file was placed on the command line!

This could be handy when the right circumstances pop up. Unfortunately, I have yet to figure out what the right circumstances are!
    •    
  • Currently 3.25 / 5
  You rated: 5 / 5 (4 votes cast)
 
[6,209 views]  

Web location files and dragging to the Terminal | 8 comments | Create New Account
Click here to return to the 'Web location files and dragging to the Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Web location files and dragging to the Terminal
Authored by: jolinwarren on Sep 04, '03 09:25:07AM

The reason that this works is because web location files are just a special type of "clipping" file. Any clipping file dragged into most applications inserts the contents of the clipping file. For instance, if you select some text in TextEdit and drag it to the desktop, a clipping will be created containing that text. Double-clicking on this clipping in the Finder will display the text. Dragging the clipping to a TextEdit document (or most any application) will insert the text into the document.

The Terminal is no different. If you drag a text clipping into a Terminal window, it inserts the clipping contents into that window instead of the path to the text clipping. Since a web location is just a special type of clipping (as is an email address clipping file), the contents get inserted.



[ Reply to This | # ]
Web location files and dragging to the Terminal
Authored by: spacehaven on Sep 04, '03 09:31:56AM

I can think of a great use for this -- I often use wget, and terminal-based browsers like links or lynx to view pages and download files. Dragging a URL right into the terminal window would be great.

Unfortunately this doesn't seem to work with the terminal program that I use, GLTerm. I just get the path to the .webloc file.



[ Reply to This | # ]
Web location files and dragging to the Terminal
Authored by: bjast on Sep 04, '03 09:59:32AM

These can be handy for creating aliases to URLs which you can force to launch in your default browser. I use them quite a bit for long URLs like:

alias apman open http://developer.apple.com/documentation/Darwin/Reference/ManPages/intro/index.html

bjast



[ Reply to This | # ]
Web location files and dragging to the Terminal
Authored by: easco on Sep 04, '03 10:20:51AM

This could be very handy when combined with a command-line URL download tool like "curl"

Type curl -O (the O is the capitol letter, not a zero and there is a space after the O). Drag the clipping file on top of the terminal window to add the URL then hit return.

You might have to add quotes around the URL as well depending on it's contents.



[ Reply to This | # ]
Web location files and dragging to the Terminal
Authored by: enigmamf on Sep 04, '03 12:54:31PM

Let me mention in favor of the guy above that I personally like wget a lot more than curl. The default option should be the common case, and there has been only once situation (just this week, actually) where I wanted the output of my download printed to standard-out (in this case I wanted to pipe it to another utility).



[ Reply to This | # ]
Web location files and dragging to the Terminal
Authored by: VEGx on Sep 04, '03 01:22:54PM

Maybe not exactly the answer you were looking, but you can control-click on the item and paste it to the Terminal...

[you might want to add "-signs in case there are spaces and whatnot.]



[ Reply to This | # ]
Web location files and dragging to the Terminal
Authored by: durin on Sep 04, '03 01:26:24PM

If you have GNU wget installed(a handy utility) this is most useful.

---

Go not to the elves for council, they will say both no and yes



[ Reply to This | # ]
Web location files and dragging to the Terminal
Authored by: ronaldo1 on Sep 05, '03 02:55:14PM

or open a web page
open http://someplace.org



[ Reply to This | # ]