Wednesday, November 18, 2009

PortableApps.com: Integrating with the Windows System

I didn't like the idea of having a separate menu for PortableApps. I would like to integrate it with the start menu, so I have everything at one place and I can search through it. I will also like to have these apps accessible through the Quick Launch menu or through a separate menu which has list of all apps without any scrollbar.

Here are the scripts which do that:

createShortcut.pl




use strict;
use Cwd;

mkdir "PortableAppsShortcuts";
my $currDir = getcwd();
my @files = <PortableApps\\*\\*.exe>;
my $file;
foreach $file (@files)
{
    my $program = "none";
    if( $file =~ m/([a-zA-Z0-9_\- ]+)Portable\.exe/ )
    {
        $program = $1;
    }
    elsif ( $file =~ m/([a-zA-Z0-9_\- ]+)\.exe/ )
    {
        $program = $1;
    }
    my $link = "$currDir\\PortableAppsShortcuts\\$program.lnk";
    my $source = "$currDir\\$file";
    
    &createLink( $link, $source );
    print "Shortcut Created: $program\n";

}

exit 0;

#==============================================================================
# Creates a shortcut for a file
#------------------------------------------------------------------------------
use Win32::OLE;
sub createLink 
{
    my ($link, $source) = @_;
    my $shell = Win32::OLE->CreateObject("WScript.Shell");
    my $oShellLink = $shell->CreateShortcut("$link" );

    $oShellLink->{TargetPath} = "$source" ;
    $oShellLink->{WindowStyle} = 1;
    $oShellLink->Save;
}



copyShortcuts.cmd




xcopy /E /I /F PortableAppsShortcuts  "%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\PortableAppsShortcuts"

xcopy /E /I /F PortableAppsShortcuts  "%USERPROFILE%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\PortableAppsShortcuts"



setEnv.cmd




PATH=%PATH%;%CD%\PortableApps\XAMPP\App\xampp\perl\bin\;%CD%\PortableApps\gVimPortable\App\vim\vim72

No comments:

Post a Comment