@rem = 'Perl, ccperl will read this as an array of assignment & skip this block
@CD /d "%~dp0"
@perl -s "%~nx0" %*
@FOR /L %%c in (5,-1,1) do @(TITLE %~nx0 - %%cs to close & ping -n 2 -w 1000 127.0.0.1 >NUL)
@TITLE Press any key to close the window&ECHO.&GOTO:EOF
@rem ';

#perl script starts below here
use strict;
use File::Basename;

my $offset = 7;
my $encry = 0;
my $first = 0;
my $file = basename $ARGV[0];
my $temp = $ARGV[0].".new";

open (F, $ARGV[0]) or die "$ARGV[0] : $!\n";
open (O, ">$temp") or die "$temp : $!\n";
while (<F>) {
    chomp;
    
    if (!$first) {
        if (m!^~~encryed~~\s*$!i) {
            $encry = 1;
            $first++;
            print "UN-Juggling $file\n";
            next;
        } else {
            print O "~~encryed~~\n";
            print "Juggling $file\n";
            $first++;
        }
    }

    my @ascii = unpack("C*", $_);
    foreach my $el (@ascii) {
        if ($encry) {
            $el -= $offset;
        } else {
            $el += $offset;
        }
    }
    my $line = pack("C*", @ascii);
    print O "$line\n";
}
close O;
close F;

unlink $ARGV[0];
rename $temp, $ARGV[0];
print "Done!\n";