ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> pdk
pdk
RE: Converting a PerlTray complied script to PerlApp compiled script?
by Jan Dubois other posts by this author
Apr 24 2009 11:57AM messages near this date
Converting a PerlTray complied script to PerlApp compiled script? | Trigger action when clicking a PerlTray Balloon?
You'll need to rewrite your application using some kind of GUI toolkit: PerlTk, Tkx, wxPerl,
 Win32::GUI etc.  I'm not sure if any of
those will allow you to place just a button on your desktop; you will typically need to have
 a client window, and then place the
button inside that client window.

 

None of these issues are related to the PDK though, except the question: Will PerlApp be abl
e to build binaries with the GUI toolkit
I have choosen.  For the ones I listed above the answer is "yes". Beyond that, please ask on
 the mailing list for the GUI toolkit
how to implement the features you are looking for.

 

Cheers,

-Jan

 

From: pdk-bounces@[...].com [mailto:pdk-bounces@[...].com] On Behalf Of Dax T. Games
Sent: Friday, April 24, 2009 6:08 AM
To: pdk@[...].com
Subject: 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 will 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 hidden 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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved