Win32::InternetShortcut - handles Internet Shortcut (IE's Favorite)
use Win32::InternetShortcut; # You can get information on an existing shortcut (if possible) my $shortcut = Win32::InternetShortcut->new('sample.url'); my $url = $shortcut->url; my $lastvisits = $shortcut->lastvisits; print "You visited $url on $lastvisits"; # and you can create a new shortcut. $shortcut->save('new.url', 'http://www.example.com/'); # You also can invoke Internet Explorer if you want. $shortcut->invoke('new.url');
Win32::InternetShortcut handles Internet Shortcuts (.URL files or Internet Explorer's Favorites files). Theoretically Internet Shortcuts are mere .INI (text) files, so you even can read with perl's open, though they have some external information, not written in the INI text. This module can handle all, ahem, almost all of them via XS.
open
Creates an object. You can pass .URL file's path.
Loads basic information (stored as plain text) into my $self, including url, modified, iconindex, iconfile. You (almost) always can get the first two.
url
modified
iconindex
iconfile
Loads advanced (and somewhat volatile) information into my $self. Most of them would be undef or duplicated, but lastvisits or title may be useful. These values seem to be lost if you move shortcuts to other folders than your Favorites folder.
lastvisits
title
Creates (or updates) a shortcut to the url.
Invokes your default browser (probably Internet Explorer) and goes to the url the shortcut points to.
Also invokes your default browser and goes to the url you point to.
Returns (or sets) the path of the shortcut. Relative path would be converted into full (absolute) path internally (and stored in $self->{fullpath}).
Clears the information my $self has.
Returns the url the shortcut points to.
Would return the stored title of the website the shortcut points to. This property is not always defined.
Would return the icon index of the shortcut (not always defined).
Would return the icon file of the shortcut (not always defined).
Returns the modified time(?) of the shortcut. This value is stored in the shortcut as plain (but obfuscated) text, so probably you can always access. If you have DateTime module, returns a DateTime object initialized by the time.
Would return the time you last visited the website the shortcut points to. This value is volatile. If you have DateTime module, returns a DateTime object initialized by the time.
Would return the last modified time(?) of the website the shortcut points to. This value is volatile. If you have DateTime module, returns a DateTime object initialized by the time.
See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_programming/shortcuts/internet_shortcuts.asp for details.
However, do NOT trust it too much. Some of the features might not be implemented or changed for your PC.
Below sites provide some useful information (at least for me).
Win32::IEFavorites
Kenichi Ishigaki, <ishigaki@cpan.org>
Copyright (C) 2006 by Kenichi Ishigaki
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Win32::InternetShortcut, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Win32::InternetShortcut
CPAN shell
perl -MCPAN -e shell install Win32::InternetShortcut
For more information on module installation, please visit the detailed CPAN module installation guide.