 |
 |
Clipboard URL > webloc file?
|
 |
|
 |
|
Mac Elite
Join Date: May 2002
Status:
Offline
|
|
anyone know if it's possible via a commandline operation to write a url from the clipboard to a .webloc (mac url clipping file)? is there special coding for this type of file or is itsimple a type/creator thing?
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Nov 2001
Location: State of Denial
Status:
Offline
|
|
Internet Location files (generic .inetloc, http/https .webloc files, etc.) have their data stored in the resource fork, in 'url ' (note final space) resource ID 256. There's no built-in clipboard -> .webloc functionalty, but it's not impossible to write a command-line tool to do it for you.
Well, providing you know your way around the Carbon Resource Manager stuff...
|
|
[Wevah setPostCount:[Wevah postCount] + 1];
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: May 2002
Status:
Offline
|
|
Would you be interested in writing such a Command Line Tool that would write to the various types of clipping files supported in X? Maybe even offer other options?
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Nov 2001
Location: State of Denial
Status:
Offline
|
|
I actually wrote up a quick tool to do just that with .inetloc, .webloc, etc. files...but I'm scared that it'll break somehow.
It works like:
% iloc http://foo.com/ foo
which will save "http://foo.com/" to foo.webloc (it sets the extension and type code according to the scheme; in this case "http").
You can also pipe in an URL, so if you have an URL copied to your clipboard you can do:
% pbpaste | iloc foo
(Edit: screwed up some prior editing.)
(Last edited by Wevah; Apr 22, 2005 at 12:12 PM.
)
|
|
[Wevah setPostCount:[Wevah postCount] + 1];
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2000
Location: Los Angeles
Status:
Online
|
|
I am surprised that the file employs a resource fork.
|

"The natural progress of things is for liberty to yield and government to gain ground." TJ
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Nov 2001
Location: State of Denial
Status:
Offline
|
|
Yep; they sure do. They're a holdover from OS 8.something, I think.
|
|
[Wevah setPostCount:[Wevah postCount] + 1];
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2000
Location: Los Angeles
Status:
Online
|
|
But then why would they also have the webloc extension? That's the head scratcher. . .
|

"The natural progress of things is for liberty to yield and government to gain ground." TJ
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Nov 2001
Location: State of Denial
Status:
Offline
|
|
No idea, aside from possibly so that other applications can associate with them by extension.
|
|
[Wevah setPostCount:[Wevah postCount] + 1];
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: May 2002
Status:
Offline
|
|
Let me know when your tool is ready wevah ... I would love to give it a try. I'm also wondering if Applescript supports something like that.
Have either of you guys heard if Apple intends to do anything with clippings in the future? Enhance then for X? Integrate them with pdf technology? etc...
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Nov 2001
Location: State of Denial
Status:
Offline
|
|
I am going to attempt to have a good version up by Monday, but I can be pretty awful when it comes to meeting deadlines. For now, it is cold and I am tired and trying to decide if I should grab some coffee and stay up, or pass out for a while. 
|
|
[Wevah setPostCount:[Wevah postCount] + 1];
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Nov 2001
Location: State of Denial
Status:
Offline
|
|
Alright, I'm a day late, but: iloc 0.1.
Lemme know if you have any suggestions or problems (hopefully it won't wipe your HD, or anything).
Edit: I seem to have screwed up reading from stdin; you have to specify an outfile for it to work. I'll fix this later.
Re-edit: Nevermind; I was using an older version by mistake.
(Last edited by Wevah; Apr 26, 2005 at 08:04 AM.
)
|
|
[Wevah setPostCount:[Wevah postCount] + 1];
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: May 2002
Status:
Offline
|
|
Great Wevah.
My first attempt spat out this error.
2005-04-26 19:01:47.833 iloc[1894] FSGetCatalogInfo got error: -35
2005-04-26 19:01:47.835 iloc[1894] FSpCreateResFile got error: -35
Hope that helps.
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Nov 2001
Location: State of Denial
Status:
Offline
|
|
Hmm, -35 is "volume not found". What's the entire command line you're using to invoke it?
|
|
[Wevah setPostCount:[Wevah postCount] + 1];
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: May 2002
Status:
Offline
|
|
My mistake.
I'm using OnMyCommand CM for this. What I did initially was name the output the same as the url so that when I tried to make a url of this post I think it was confused about the characters.
Initial code was:
/usr/local/bin/iloc __OBJ_TEXT__ /Users/me/Desktop/__OBJ_TEXT__
I added a dialog for me to name the file and this works fine:
/usr/local/bin/iloc __OBJ_TEXT__ /Users/me/Desktop/__DLG_INPUT_TEXT__
This works great, all I do is highlight the copy, ctrl click and it creates a clipping in a location of my choice.
Thanks Wevah. Any chance of adding picture, rtf, sound support, in the future?
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Nov 2001
Location: State of Denial
Status:
Offline
|
|
Oh, excellent. I figured it was some special-case thing, thoug at least I know that the error can happen (I still need to add more helpful error text, as you can see).
I plan on rolling a lot of this into a larger app, at some point. So yes, I will probably add other clipping formats at some point in the future.
Your initial code might still work, providing you enclose the arguments in quotes:
/usr/local/bin/iloc "__OBJ_TEXT__" "/Users/me/Desktop/__OBJ_TEXT__"
otherwise, if there are spaces in __OBJ_TEXT__ it will think there are more than two arguments...it might still not work, but it's worth a shot if you don't want to have to input the name by hand each time. Though if it's just an URL it should still work...hmmm.
Oh well, it's working for you now, and that's what matters!
|
|
[Wevah setPostCount:[Wevah postCount] + 1];
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|