Here's how to create a Windows shortcut, including some handy constants for building up a hotkey. Thanks to Foggy Bottoms for the starting point, I just enumerated the metakey codes through experimentation.
Amended: use constant
Amended: pick up USERPROFILE
use constant SHIFT => 0x0100; use constant CTRL => 0x0200; use constant ALT => 0x0400; my $LINK=new Win32::Shortcut(); $LINK->Set('c:\targetfile', '', # arguements 'c:\', # directory tto execute in 'Perl Shortcut', # description 1, # window state (1 is normal) SHIFT+CTRL+ord('S'), # shorcut key '', # icon file eg win32.dll 0); # icon number in file my $shortfile = $ENV{USERPROFILE}.'\Start Menu\Programs\Acces +sories\shortcut.lnk'; $LINK->Save($shortfile); # run Explorer targetting the file just created # system("Explorer /e,/select,$shortfile"); $LINK->Close();
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Creating a Windows shortcut file
by Brutha (Friar) on Aug 14, 2003 at 13:22 UTC |
Back to
Cool Uses for Perl