The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Win32::InternetShortcut - handles Internet Shortcut (IE's Favorite)

SYNOPSIS

  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');

DESCRIPTION

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.

METHODS

new (path)

Creates an object. You can pass .URL file's path.

load (path) [XS]

Loads basic information (stored as plain text) into my $self, including url, modified, iconindex, iconfile. You (almost) always can get the first two.

load_properties (path) [XS]

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.

save (path, url) [XS]

Creates (or updates) a shortcut to the url.

invoke (path) [XS]

Invokes your default browser (probably Internet Explorer) and goes to the url the shortcut points to.

invoke_url (url) [XS]

Also invokes your default browser and goes to the url you point to.

path (optional path)

Returns (or sets) the path of the shortcut. Relative path would be converted into full (absolute) path internally (and stored in $self->{fullpath}).

clear

Clears the information my $self has.

url

Returns the url the shortcut points to.

title

Would return the stored title of the website the shortcut points to. This property is not always defined.

iconindex

Would return the icon index of the shortcut (not always defined).

iconfile

Would return the icon file of the shortcut (not always defined).

modified

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.

lastvisits

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.

lastmod

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.

NOTES

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).

http://www.cyanwerks.com/file-format-url.html
http://www.techieone.com/detail-6264254.html
http://www.arstdesign.com/articles/iefavorites.html

SEE ALSO

Win32::IEFavorites

AUTHOR

Kenichi Ishigaki, <ishigaki@cpan.org>

COPYRIGHT AND LICENSE

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.