I often use MSIE to browse the web on my NT box, and every so often I add a link to my "Favorites" bar. Now the list has gotten rather long and unweildy and so I said to myself, "Wouldn't it be nice to have a page with these links as my start page?" Well... it would. So I wrote this hack of a script to read my favorites and generate a page, which I then set as my start page.

Now I just need to figure out how to make it run automatically when I add links to my favorites.


#!perl -w use strict; my $file = "Link.html"; # File to generate. my $lcolor = "#C0C0C0"; # Color for links. my %links; for( <*.url> ) { my $link = `type "$_"` or die "$^E"; die "System Error! $?\n\$!=$!\n\$^E=$^E\n\t " if 0 != $? >> 8; die "Unusual link, '$link'\n" unless $link =~ s/^ (\[DEFAULT\]\nBASE|\[InternetShortcut\]\n) URL=([^\n]+) # This is the URL for the link. \n.*$/$2/sx; $links{+substr($_,0,-4)} = $link; } my @linkName = reverse sort keys %links; my @linkURL = @links{@linkName}; warn "Replacing $file!\n" and sleep 3 if -e $file; open FILE, "> $file" or die "Unable to open $file!\n\$!=$!\n\$^E=$^E\n +\t "; print FILE "<HTML>\n<HEAD><TITLE>Favorite Links</TITLE></HEAD>\n", "<BODY bgcolor=#000000 link=$lcolor alink=$lcolor vlink=$lc +olor>\n", "<CENTER><B><TABLE WIDTH=100%>\n" or die "Print Failed!\n\$!=$!\n\$^E=$^E\n\t "; print FILE "<TR><TD><A HREF=\"", pop( @linkURL ), "\">", pop( @linkNam +e ), ( @linkURL ? ( "</A></TD>\n<TD><A HREF=\"", pop( @linkURL ) +, "\">", pop( @linkName ) ) : "&nbsp;" ), "</A></TD></TR>\n" or die "Print Failed!\n\$!=$!\n\$^E=$^E\n\t " while @linkUR +L; print FILE "</TABLE>\n</BODY>\n</HTML>\n" or die "Print Failed!\n\$!=$!\n\$^E=$^E\n\t "; close FILE or die "Close Failed!\n\$!=$!\n\$^E=$^E\n\t "; ###################################################################### +######### INIT { die "Intended for use on MSWin32 system.\n" unless 'MSWin32' eq + $^O } =head1 Usage Open a command window on your MSWin32 and change directories to Your Favorites\Links\ directory. On my NT box this was: C:\WINNT\Profiles\Adam\Favorites\Links\ Run this script. You will now have a file called Links.html which makes for an excellen +t start page. =head1 Author Adam www.perlmonks.org =cut

In reply to MSIE Favorite Start Page by Adam

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.