Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

pudge (1)

pudge
  (email not shown publicly)
http://pudge.net/
AOL IM: Crimethnk (Add Buddy, Send Message)

I run this joint, see?

Journal of pudge (1)

Thursday August 28, 2003
12:04 PM

Create a URL clipping file

[ #14369 ]

There are three resources in the clipping I got from Safari: TEXT, url, and drag. TEXT and url are the same, and TEXT doesn't seem to do anything. Neither does drag, so I just put in the url resource, which seems to work just fine. If more is needed, it can be added. (Note: you can use DeRez to see what is in a resource file, in /Developer/Tools/ or somesuch).

So anyway, this little bit of code works for me, share and enjoy. Mac::Carbon required.

#!/usr/local/bin/perl
use strict;
use warnings;
 
use File::Spec::Functions;
use Mac::Errors '$MacError';
use Mac::Files;
use Mac::Memory;
use Mac::Resources;
 
my $url  = new Handle "http://projects.pudge.net/";
my $file = catfile(FindFolder(kUserDomain, kDesktopFolderType), "projects.webloc");
 
FSpCreateResFile($file, 'MACS', 'ilht', 0) or die $MacError;
my $RF = FSpOpenResFile($file, 0) or die $MacError;
 
AddResource($url, 'url ', 256, '');
 
UpdateResFile($RF);
CloseResFile($RF);

Now Playing: Desire - U2

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.