Author Topic: Script to select and name packed 7z with entered password from 7-zip  (Read 97582 times)

AriesTruong

  • Active Member
  • ***
  • Posts: 58
    • View Profile
Hi All,

Currently MC support pack well but if you need create 7z, zip format with password then I cannot use with Packed from internal. So create Custom Command and add into Context Menu so that I can create archive file with password and some option from 7-zip when need.

Copy whole folder 7-zip if you installed and install new to MC folder. The below is script for command
========================Script===========================
@var $filepath_zip = "";
@var $files = "";
@var $n = 0;
@var $numfiles = 1;
@var $runpg = GetTagValue("${mcinstallpath}") ^ "7-zip\7zG.exe";
@var $arr_selected_items[] = GetSourceSelectedPaths();
@var $location = GetSourcePath();
// Only run script when there is 1 selected items at least
if( arrayCount($arr_selected_items) >= 1 )
{
   $files = "\"" + $arr_selected_items[0] + "\"";
   $filepath_zip = PathGetNamePart($arr_selected_items[0], 1) + ".7z";
   for ($n=1; $n < arrayCount($arr_selected_items); $n++)
   {
      $files = $files + " \"" + $arr_selected_items[$n] + "\"";
      $numfiles = $numfiles + 1;
   }
   // When there are more 1 selected item then filepath_zip is folder on selected tab.
   if ($numfiles > 1)
   {   
      $filepath_zip = PathGetNamePart(StrSub($location,0,StrLen($location) - 1), 1) + ".7z";
   }
   $filepath_zip = "\"" + $location ^ $filepath_zip + "\"";
   MC.Run CMD="{$runpg}" ARG="a {$filepath_zip} {$files} -ad"
}
=======================End Script===================================

Thanks,
« Last Edit: August 15, 2019, 05:22:40 by AriesTruong »
Life changes when we change