Converting a PerlTray complied script to PerlApp compiled script?
by Dax T. Games other posts by this author
Apr 24 2009 6:08AM messages near this date
RE: Win32::MsgBox not showing
|
RE: Converting a PerlTray complied script to PerlApp compiled script?
I wrote the following PerTray script YEARS ago. It is a simple script that parses a directo
ry for *.LNK, *.URL, and *.HT and creates a basic launcher menu in the system tray.
I would like to change this to be a standalone EXE that does not use the System Tray and com
pile it with PerlApp instead. Basically I want to create an on screen button when pushed wi
ll popup this simple launcher menu.
I would like to be able to control the position of the button and it would be really nice if
I coul make it respont to a hotkey combination to bring it to the foreground when it is hid
den by another window.
Any suggestions because I have no idea where to start?
Code begins here:
##############################################################################
# START MAIN
#
#
# SET SOME VARIABLES.
#
$Version = "0.0.2";
use PerlTray;
use File::Find;
use FindBin qw($Bin);
sub PopupMenu {
($Links, $URLs, $HTs) = Scan(\@Links,\@URLs,\@HTs);
return [@$Links,
["-------"],
@$URLs,
["-------"],
@$HTs,
["-------"],
#["* Browse","Execute('$Bin')"],
["Exit","ExitNow()"]
];
}
sub Scan {
my ($Links, $URLs, $HTs) = @_;
my(@Links,@URLs,@HTs);
find(sub {
($Links, $URLs, $HTs) = ReadShortcuts($File::Find::name,\@Links,\@URLs,\@HTs)
},$Bin);
return ($Links, $URLs, $HTs);
}
sub ReadShortcuts {
my ($LS_LnkFilename, $Links, $URLs, $HTs) = @_;
my $LS_FilePath;
if (-e $LS_LnkFilename && $_ =~ /(.+?)\.lnk$/i) {
if ($_ =~ /HyperTerm (.+?).lnk$/i) {
push @$HTs, ["$1", "Execute('$LS_LnkFilename')"];
}
else {
push @$Links, ["$1", "Execute('$LS_LnkFilename')"];
}
}
elsif (-e $LS_LnkFilename && $_ =~ /(.+?)\.url$/i) {
open(IN,$LS_LnkFilename);
$Desc = $1;
while (<IN> ) {
if ($_ =~ /^URL=(.+)/i) {
$Exe = $1;
}
}
close(IN);
push @$URLs, ["$Desc", "Execute('$Exe')"];
}
return (sort($Links), sort($URLs), sort($HTs));
}
sub ToolTip {
return ("My Shortcut Menu");
}
sub ExitNow {
exit;
}
Code Ends Here.
Thread:
Dax T. Games
Jan Dubois
|