use of new zip commands

Discuss and share scripts and script files...
Post Reply
totmad1
Posts: 131
Joined: 24 Jun 2013 12:37

use of new zip commands

Post by totmad1 »

Here are 1. zip & move to other pane
2. list this zip
3. list zips in this folder

Code: Select all

"_Initialize";
	$file = self  ("file");
	end (compare(<xyver>, 12.50.0016, v) >= 0),,1;
        msg "WARNING: requires XYplorer v12.50.0016 in order to work properly.<br><br>You are currently running an older version (<xyver>), are you sure you want to continue anyway ?<br><br>Note that this might lead to errors / unexpected results.", 1;
-
"Convert files/folders into <curfolder>.zip && Move to other pane : zip"
               $SelectedItems = get("SelectedItemsPathNames", "|");
               $a =  get("path", i);
              zip_add( "$a\<curfolder>.zip" , $SelectedItems, "|")
-
"Extract to other pane"
               $a =  get("path", i);
                zip_extract( , $a);
"Extract to other pane (\<curbase>"
               $a =  get("path", i);
                zip_extract( , $a\<curbase>\);
"(smart)Extract to other pane"
                 $a =  get("path", i);  $zfile = "";
                 $pList = zip_list( , <crlf>);
                 $file = gettoken( $pList, 1, <crlf>);
                 $pPath = getpathcomponent( "$file", "component", -2);
                         if ( $pPath == "" ) {
                            zip_extract( , $a\<curbase>\);
                          }

                     else  {
                           zip_extract( , "$a\");
                           }
"(smart)Extract Here"
                 $a =  get("path", a);  $zfile = "";
                 $pList = zip_list( , <crlf>);
                 $file = gettoken( $pList, 1, <crlf>);
                 $pPath = getpathcomponent( "$file", "component", -2);
                         if ( $pPath == "" ) {
                            zip_extract( , $a\<curbase>\);
                          }

                     else  {
                           zip_extract( , "$a\");
                           }
-
"list this Zip" text zip_list(, <crlf>);
"List zips in this folder (<curfolder>1.txt)"
        selfilter "*.zip"; $CList =""; $pList ="";
        $SelectedItems = get("SelectedItemsPathNames", "|");
              
        foreach($Item, $SelectedItems, "|") {
              
        $pList =zip_list("$Item", <crlf>, );

        $CList = $CList . $Item<crlf> $pList <crlf><crlf>;
             $pList ="";
          }

            writefile("<curfolder>1.txt", $CList);
-
"Edit script : edit"
   $ScriptFile= self ("file");
	    run $p_note $ScriptFile,w;
"Choose scripts file to edit" $file = inputfile  (<xyscripts>\, xys, Select Scripts File); open $file
-
"CANCEL"
"_Terminate"
  ;
Hope you find useful as a start/taster for the short period I expect it to be before it's superceded.
extensions do show up when all are seen in windows explorer.
Just had a thought you could extract to other pane using zip_extract.

Updated to include extract (smart)Extract included.

totmad1 (totally mad one)


updated 4jul2013

lines 3 and 4 because of use of later enhancements

Code: Select all

	end (compare(<xyver>, 12.50.0023, v) >= 0),,1;
        msg "WARNING: requires XYplorer v12.50.0023 in order to work properly.<br><br>You are currently running an older version (<xyver>), are you sure you want to continue anyway ?<br><br>Note that this might lead to errors / unexpected results.", 1;
and also this code can be added

Code: Select all

"Choice extract Files from zip to other pane" 
			//   see    by serendipity » 01 Jul 2013 23:03       http://www.xyplorer.com/xyfc/viewtopic.php?f=5&t=7976&start=135
			//    and of course  http://www.xyplorer.com/xyfc/viewtopic.php?f=1&t=4&start=2625
		$a =  get("path", i);		//   added  to get path to other pane
		zip_extract (,$a,inputselect("Check Items to extract to Other pane",replace(zip_list(,"|",0),"<tab>", ""),"|", 11 ,,,,"<curitem>"),"|");  
totmad1 (totally mad one)
totmad1 (totally mad one)

Post Reply