Smart archive extraction (enhanced)

Discuss and share scripts and script files...
Post Reply
Norn
Posts: 504
Joined: 24 Oct 2021 16:10

Smart archive extraction (enhanced)

Post by Norn »

Code: Select all

/*
******************************************************************************
@Created : 2022-03-15
@Modified: 2022-03-23
@Function: [Bandizip Overwrite Mode]Extract selected items or clipboard to Archive-Name folder. [View all items in the paper folder <Show folder size>, Move the folder up If only one Archive-Name folder in the archive, View each extracted item <only folder in archive> in the new tab, View each extracted item in the new tab, Set label of extracted item to grey]
@Version : v8.2
******************************************************************************
*/

    //Handle .ini file
    $iniFile = self("path") . "\" . "INI" . "\" . self("base") . "Interval Time" . ".ini";

    //Write .ini file if missing
    if (exists($iniFile) != 1) {
        $iniContent = <<<'>>>'


//Interval Time
[Interval Time]
Time=3000


;The last query you've used
LastQuery=
        >>>;
        writefile($iniFile, $iniContent, , "tu");
    }



    //Get Interval time
    $Time     = getkey("Time",     "Interval Time", $iniFile);



//Icons
	$iconCfi     = ":cfi"; 
	$icon2     = ":clip"; 
	$icon23     = ":#23";
	$icon36     = ":#36";
	$icon6     = ":udc";
	$count = get("CountSelected");  //CountSelected


//Parameters
    $menu   = "";
	set $SelectedItems, <clipboard>;              //Set $SelectedItems = Contents of the current clipboard
	$SI2 = get("SelectedItemsPathNames", "<crlf>", a);
    //$SI2 = replace($SI, "|", "<crlf>");
	$EXT = get("SelExt", "|");
	$EXT = replace($EXT, "*", "\");
	$SI3 = regexreplace("$SI2", "$EXT|", "", "|", 0, 1);


//Add Menu
            $menu = <crlf> . "-Extract selected items or clipboard to Archive-Name folder-        [$count items selected]" . "<:>" . "<:>" . $iconCfi;
			$menu2 .= <crlf> . "Extract clipboard to Archive-Name folder" . "<:>" . "<:>" . $icon2;						
			$menu3 = <crlf> . "Extract selected items to Archive-Name folder" . "<:>" . "<:>" . $icon36;	
            $menu5 = <crlf> . "Extract selected items to Archive-Name folder in the last clicked item path" . "<:>" . "<:>" . $icon23;
			$menu6 = <crlf> . "Set Interval Time" . "<:>" . "<:>" . $icon6;

//Menus
    $selection = popupnested("$menu<crlf><:>$menu2<crlf>$menu3<crlf>$menu5<crlf>$menu6", 6:=<crlf>, 7:="<:>");
	if ($selection) {
	if(regexmatches("$selection", "Extract selected items or clipboard to Archive-Name folder")) {end 1==1};





//Extract clipboard to Archive-Name folder	
	if(regexmatches("$selection", "Extract clipboard to Archive-Name folder")) {
	foreach($Item, $SelectedItems, "<crlf>") {
		if($Item == ""){ break; }
		if(strpos($Item, "\", 0, 1) != "-1"){
			$Path = regexreplace($Item, "(.*\\)(.*)", "$1");                                                     //Get the path of each item
			$ItemName = regexreplace($Item, "(.*\\)(.*)", "$2");                                                 //Get the file name of each item
			$Base = regexreplace("$ItemName", "\.zip|\.rar|\.7z|", "", "|", 0, 1);                               //replace ext to get base name
//Ask if .zip .rar .7z do not contain
	if(!regexmatches($Item, "\.zip")&&!regexmatches($Item, "\.rar")&&!regexmatches($Item, "\.7z")) {
	$confirm = confirm("Clipboard content does not contain .zip .rar .7z, continue?");
	if($confirm == "0") {end 1==1;}
     }			
			run """C:\Program Files\Bandizip\Bandizip.exe"" x -aoa -o:""$Path$Base"" ""$Item"""; wait "$Time";  //Extract to Archive-Name folder	   Overwrite:"-aoa"   Skip:"-aos"
	} 
  }
}
//View all items?
    if(regexmatches("$selection", "Extract clipboard to Archive-Name folder")) {
	$count = gettoken($selection, "count", <crlf>);
     while ($selection == "Extract clipboard to Archive-Name folder") {
	$confirm = inputselect("$count items extracted, View all extracted items?", "+View all items in the paper folder <Show folder size>,+Move the folder up If only one Archive-Name folder in the archive,View each extracted item <only folder in archive> in the new tab,View each extracted item in the new tab,Set label of extracted item to grey,<Ask again in 5 seconds>", "," , "2", "cancel", "432", "271", "Tips", , ":fore-");
     if(regexmatches($confirm, "<Ask again in 5 seconds>")) {wait 5000;}           //Wait 5S
     if(!regexmatches($confirm, "<Ask again in 5 seconds>")) {break;}
 }
//View all items in the paper folder <Show folder size>		
			if(regexmatches($confirm, "View all items in the paper folder <Show folder size>")) {
			$confirm = replace("$confirm", "View each extracted item in the new tab", "");
			$name       = now("yyyy-mm-dd-hhnnss");									//Paper folder name
            $paper  		= "%temp%\EverythingForXYplorer\$name.txt";             //Paper folder path
            tab("new");                                                             //New tab
            paperfolder("$name", "$SI3<crlf>$SI2", , , "1");     					//Open Paper folder
            if(get('#417') == "0") {#417;}                                          //Show folder size
            }
		foreach($Item, $SelectedItems, "<crlf>") {
		    if($Item == ""){ break; }
		    if(strpos($Item, "\", 0, 1) != "-1"){
			$Path = regexreplace($Item, "(.*\\)(.*)", "$1");
			$ItemName = replace("$Item", "$Path");
            $Base = regexreplace("$ItemName", "\.zip|\.rar|\.7z|", "", "|", 0, 1); //replace ext to get base name
			if($confirm == "cancel") {end 1==1;}			
//Move the folder up If only one Archive-Name folder in the archive
    if(regexmatches("$confirm", "Move the folder up If only one Archive-Name folder in the archive")) {
           if(exists("$Path$Base\$Base\") == "2") {
           if(listfolder("$Path$Base\", "*.*", 1+4, <crlf>) == "") {
		   wait 300;
           moveto "$Path", "$Path$Base\$Base\";
           } 
           }
	       }
//View each extracted item <only folder in archive> in the new tab
			if(regexmatches($confirm, "View each extracted item <only folder in archive> in the new tab")) {			
			if(exists("$Path$Base\") == "2") {
			if(listfolder("$Path$Base\", "*.*", 1+4, <crlf>) == "") {
			tab('new',"$Path$Base");
			}
			}
			}
//View each extracted item in the new tab
			if(regexmatches($confirm, "View each extracted item in the new tab") && !regexmatches($confirm, "View each extracted item <only folder in archive> in the new tab")) {
			if(exists("$Path$Base\") == "2") {
			tab('new',"$Path");
			wait "100";  //Interval Time
			selectitems "$Base";
            }}
//Set label of extracted item to grey
			if(regexmatches($confirm, "Set label of extracted item to grey")) {
            tagitems("lbl", "7", "$Path\$Base");
	        }
    }
  }
}
	if(regexmatches("$selection", "Extract clipboard to Archive-Name folder")) {end 1==1;}                 //end




	
//Extract selected items to Archive-Name folder in the last clicked item path
	if(regexmatches("$selection", "Extract selected items to Archive-Name folder in the last clicked item path")) {
	if($EXT != "\.zip" && $EXT != "\.rar" && $EXT != "\.7z") {msg "Only one format can be selected for this option!"; end 1==1;}
		run """C:\Program Files\Bandizip\Bandizip.exe"" bx -aoa -o:""<curitempath>\<curbase>"" <selitems>";                      //Extract to Archive-Name folder	   Overwrite:"-aoa"   Skip:"-aos"					 
	}
//View all items?
    if(regexmatches("$selection", "Extract selected items to Archive-Name folder in the last clicked item path")) {
	$count = gettoken($SI2, "count", <crlf>);
	 while ($selection == "Extract selected items to Archive-Name folder in the last clicked item path") {
    $confirm = inputselect("$count items extracted, View all extracted items?", "+View extracted item in the new tab,View extracted item <only folder in archive> in the new tab,+Move the folder up If only one Archive-Name folder in the archive,Set label of extracted item to grey,<Ask again in 5 seconds>", "," , "2", "cancel", "432", "252", "Tips", , ":fore-");	
     if(regexmatches($confirm, "<Ask again in 5 seconds>")) {wait 5000;}           //Wait 5S
     if(!regexmatches($confirm, "<Ask again in 5 seconds>")) {break;}
 }	 
            $curitempath = "<curitempath>";
			$curbase = "<curbase>";
			if($confirm == "cancel") {end 1==1;}
//Move the folder up If only one Archive-Name folder in the archive
    if(regexmatches("$confirm", "Move the folder up If only one Archive-Name folder in the archive")) {
           if(exists("<curitempath>\<curbase>\<curbase>\") == "2") {
           if(listfolder("<curitempath>\<curbase>\", "*.*", 1+4, <crlf>) == "") {
		   wait 300;
           moveto "<curitempath>\", "<curitempath>\<curbase>\<curbase>\";
           } 
           }
		   }
//View extracted item <only folder in archive> in the new tab
            if(regexmatches($confirm, "View extracted item <only folder in archive> in the new tab")) {
			if(exists("$curitempath\$curbase\") == "2") {
			if(listfolder("$curitempath\$curbase\", "*.*", 1+4, <crlf>) == "") {
			tab('new',"$curitempath\$curbase\");
			}
			}
			}
//View extracted item in the new tab
			if(regexmatches($confirm, "View extracted item in the new tab") && !regexmatches($confirm, "View extracted item <only folder in archive> in the new tab")) {
			if(exists("$curitempath\$curbase\") == "2") {
			tab('new',"$curitempath");									
			wait "100";  //Interval Time
			selectitems "$curbase";
			}}
//Set label of extracted item to grey
            if(regexmatches($confirm, "Set label of extracted item to grey")) {
            tagitems("lbl", "7", "$curitempath\$curbase");
	}
}
	if(regexmatches("$selection", "Extract selected items to Archive-Name folder in the last clicked item path")) {end 1==1;}                 //end	





//Extract selected items to Archive-Name folder
	if(regexmatches("$selection", "Extract selected items to Archive-Name folder")) {
	foreach($Item2, $SI2, "<crlf>") {
		if($Item2 == ""){ break; }
		if(strpos($Item2, "\", 0, 1) != "-1"){
			$Path = regexreplace($Item2, "(.*\\)(.*)", "$1");                                         //Get the path of each item
            $ItemName = regexreplace($Item2, "(.*\\)(.*)", "$2");                                     //Get the file name of each item
			$Base = regexreplace("$ItemName", "$EXT|", "", "|", 0, 1);                                //replace ext to get base name
			run """C:\Program Files\Bandizip\Bandizip.exe"" x -aoa -o:""$Path$Base"" ""$Item2""";     //Extract to Archive-Name folder	   Overwrite:"-aoa"   Skip:"-aos"
            wait "$Time";        //Interval Time
		} 
	}
}	
//View all items?
    if(regexmatches("$selection", "Extract selected items to Archive-Name folder")) {
	$count = gettoken($SI2, "count", <crlf>);
     while ($selection == "Extract selected items to Archive-Name folder") {
	$confirm = inputselect("$count items extracted, View all extracted items?", "+View all items in the paper folder <Show folder size>,+Move the folder up If only one Archive-Name folder in the archive,View each extracted item <only folder in archive> in the new tab,View each extracted item in the new tab,Set label of extracted item to grey,<Ask again in 5 seconds>", "," , "2", "cancel", "432", "271", "Tips", , ":fore-");
     if(regexmatches($confirm, "<Ask again in 5 seconds>")) {wait 5000;}           //Wait 5S
     if(!regexmatches($confirm, "<Ask again in 5 seconds>")) {break;}
 }	 
//View all items in the paper folder <Show folder size>	
			if(regexmatches($confirm, "View all items in the paper folder <Show folder size>")) {
			$confirm = replace("$confirm", "View each extracted item in the new tab", "");
			$name       = now("yyyy-mm-dd-hhnnss");									//Paper folder name
            $paper  		= "%temp%\EverythingForXYplorer\$name.txt";             //Paper folder path
            tab("new");                                                             //New tab
            paperfolder("$name", "$SI3<crlf>$SI2", , , "1");     				    //Open Paper folder
            if(get('#417') == "0") {#417;}                                          //Show folder size
            }					
	foreach($Item, $SI2, "<crlf>") {
		if($Item == ""){ break; }
		if(strpos($Item, "\", 0, 1) != "-1"){
			$Path = regexreplace($Item, "(.*\\)(.*)", "$1");                                           //Get the path of each item
			$ItemName = replace("$Item", "$Path");                                                     //Get the file name of each item
            $Base = regexreplace("$ItemName", "$EXT|", "", "|", 0, 1);                                 //replace ext to get base name
			if($confirm == "cancel") {end 1==1;}			
//Move the folder up If only one Archive-Name folder in the archive
    if(regexmatches("$confirm", "Move the folder up If only one Archive-Name folder in the archive")) {
           if(exists("$Path$Base\$Base\") == "2") {
           if(listfolder("$Path$Base\", "*.*", 1+4, <crlf>) == "") {
		   wait 300;
           moveto "$Path", "$Path$Base\$Base\";
           } 
           }
		   }
//View each extracted item <only folder in archive> in the new tab
			if(regexmatches($confirm, "View each extracted item <only folder in archive> in the new tab")) {
			if(exists("$Path$Base\") == "2") {
			if(listfolder("$Path$Base\", "*.*", 1+4, <crlf>) == "") {
			tab('new',"$Path$Base");
			}
			}
			}
//View each extracted item in the new tab
			if(regexmatches($confirm, "View each extracted item in the new tab") && !regexmatches($confirm, "View each extracted item <only folder in archive> in the new tab")) {
			if(exists("$Path$Base\") == "2") {			tab('new',"$Path");			
			wait "100";  //Interval Time
			selectitems "$Base";	                //Select the extracted item
			}}
//Set label of extracted item to grey			
			if(regexmatches($confirm, "Set label of extracted item to grey")) {
            tagitems("lbl", "7", "$Path$Base");
	  }
	 }
   }
}
	if(regexmatches("$selection", "Extract selected items to Archive-Name folder")) {end 1==1;}                 //end  





//Set Interval Time
    if(regexmatches("$selection", "Set Interval Time")) {
	$Time = input("Set Interval Time, In Milliseconds", , "$Time", "m", "cancel", "100", "500");
	if $Time == "cancel" {end 1==1;}
	setkey $Time, "Time", "Interval Time", $iniFile;          //Save Interval Time
	end 1==1;} 	

	 if $selection == "" {end 1==1;}
     load $selection, , "s";
	}

Code: Select all

/*
******************************************************************************
@Created : 2022-03-15
@Modified: 2022-03-23
@Function: [WinRAR Overwrite Mode]Extract selected items or clipboard to Archive-Name folder. [View all items in the paper folder <Show folder size>, Move the folder up If only one Archive-Name folder in the archive, View each extracted item <only folder in archive> in the new tab, View each extracted item in the new tab, Set label of extracted item to grey]
@Version : v8.2
******************************************************************************
*/

    //Handle .ini file
    $iniFile = self("path") . "\" . "INI" . "\" . self("base") . "Interval Time" . ".ini";

    //Write .ini file if missing
    if (exists($iniFile) != 1) {
        $iniContent = <<<'>>>'


//Interval Time
[Interval Time]
Time=3000


;The last query you've used
LastQuery=
        >>>;
        writefile($iniFile, $iniContent, , "tu");
    }



    //Get Interval time
    $Time     = getkey("Time",     "Interval Time", $iniFile);



//Icons
	$iconCfi     = ":cfi"; 
	$icon2     = ":clip"; 
	$icon23     = ":#23";
	$icon36     = ":#36";
	$icon6     = ":udc";
	$count = get("CountSelected");  //CountSelected


//Parameters
    $menu   = "";
	set $SelectedItems, <clipboard>;              //Set $SelectedItems = Contents of the current clipboard
	$SI2 = get("SelectedItemsPathNames", "<crlf>", a);
    //$SI2 = replace($SI, "|", "<crlf>");
	$EXT = get("SelExt", "|");
	$EXT = replace($EXT, "*", "\");
	$SI3 = regexreplace("$SI2", "$EXT|", "", "|", 0, 1);


//Add Menu
            $menu = <crlf> . "-Extract selected items or clipboard to Archive-Name folder-        [$count items selected]" . "<:>" . "<:>" . $iconCfi;
			$menu2 .= <crlf> . "Extract clipboard to Archive-Name folder" . "<:>" . "<:>" . $icon2;						
			$menu3 = <crlf> . "Extract selected items to Archive-Name folder" . "<:>" . "<:>" . $icon36;	
            //$menu5 = <crlf> . "Extract selected items to Archive-Name folder in the last clicked item path" . "<:>" . "<:>" . $icon23;
			$menu6 = <crlf> . "Set Interval Time" . "<:>" . "<:>" . $icon6;

//Menus
    $selection = popupnested("$menu<crlf><:>$menu2<crlf>$menu3<crlf>$menu6", 6:=<crlf>, 7:="<:>");
	if ($selection) {
	if(regexmatches("$selection", "Extract selected items or clipboard to Archive-Name folder")) {end 1==1};





//Extract clipboard to Archive-Name folder	
	if(regexmatches("$selection", "Extract clipboard to Archive-Name folder")) {
	foreach($Item, $SelectedItems, "<crlf>") {
		if($Item == ""){ break; }
		if(strpos($Item, "\", 0, 1) != "-1"){
			$Path = regexreplace($Item, "(.*\\)(.*)", "$1");                                                     //Get the path of each item
			$ItemName = regexreplace($Item, "(.*\\)(.*)", "$2");                                                 //Get the file name of each item
			$Base = regexreplace("$ItemName", "\.zip|\.rar|\.7z|", "", "|", 0, 1);                               //replace ext to get base name
//Ask if .zip .rar .7z do not contain
	if(!regexmatches($Item, "\.zip")&&!regexmatches($Item, "\.rar")&&!regexmatches($Item, "\.7z")) {
	$confirm = confirm("Clipboard content does not contain .zip .rar .7z, continue?");
	if($confirm == "0") {end 1==1;}
     }			
            run """D:\Program Files\WinRAR\WinRAR.exe"" e -o+ ""$Item"" ""$Path$Base\"""; wait "$Time";		                 //Extract to Archive-Name folder	     Overwrite:"-o+"   Skip:"-o-"
	} 
  }
}
//View all items?
    if(regexmatches("$selection", "Extract clipboard to Archive-Name folder")) {
	$count = gettoken($selection, "count", <crlf>);
     while ($selection == "Extract clipboard to Archive-Name folder") {
	$confirm = inputselect("$count items extracted, View all extracted items?", "+View all items in the paper folder <Show folder size>,+Move the folder up If only one Archive-Name folder in the archive,View each extracted item <only folder in archive> in the new tab,View each extracted item in the new tab,Set label of extracted item to grey,<Ask again in 5 seconds>", "," , "2", "cancel", "432", "271", "Tips", , ":fore-");
     if(regexmatches($confirm, "<Ask again in 5 seconds>")) {wait 5000;}           //Wait 5S
     if(!regexmatches($confirm, "<Ask again in 5 seconds>")) {break;}
 }
//View all items in the paper folder <Show folder size>		
			if(regexmatches($confirm, "View all items in the paper folder <Show folder size>")) {
			$confirm = replace("$confirm", "View each extracted item in the new tab", "");
			$name       = now("yyyy-mm-dd-hhnnss");									//Paper folder name
            $paper  		= "%temp%\EverythingForXYplorer\$name.txt";             //Paper folder path
            tab("new");                                                             //New tab
            paperfolder("$name", "$SI3<crlf>$SI2", , , "1");     					//Open Paper folder
            if(get('#417') == "0") {#417;}                                          //Show folder size
            }
		foreach($Item, $SelectedItems, "<crlf>") {
		    if($Item == ""){ break; }
		    if(strpos($Item, "\", 0, 1) != "-1"){
			$Path = regexreplace($Item, "(.*\\)(.*)", "$1");
			$ItemName = replace("$Item", "$Path");
            $Base = regexreplace("$ItemName", "\.zip|\.rar|\.7z|", "", "|", 0, 1); //replace ext to get base name
			if($confirm == "cancel") {end 1==1;}			
//Move the folder up If only one Archive-Name folder in the archive
    if(regexmatches("$confirm", "Move the folder up If only one Archive-Name folder in the archive")) {
           if(exists("$Path$Base\$Base\") == "2") {
           if(listfolder("$Path$Base\", "*.*", 1+4, <crlf>) == "") {
		   wait 300;
           moveto "$Path", "$Path$Base\$Base\";
           } 
           }
	       }
//View each extracted item <only folder in archive> in the new tab
			if(regexmatches($confirm, "View each extracted item <only folder in archive> in the new tab")) {			
			if(exists("$Path$Base\") == "2") {
			if(listfolder("$Path$Base\", "*.*", 1+4, <crlf>) == "") {
			tab('new',"$Path$Base");
			}
			}
			}
//View each extracted item in the new tab
			if(regexmatches($confirm, "View each extracted item in the new tab") && !regexmatches($confirm, "View each extracted item <only folder in archive> in the new tab")) {
			if(exists("$Path$Base\") == "2") {
			tab('new',"$Path");
			wait "100";  //Interval Time
			selectitems "$Base";
            }}
//Set label of extracted item to grey
			if(regexmatches($confirm, "Set label of extracted item to grey")) {
            tagitems("lbl", "7", "$Path\$Base");
	        }
   }
  }
}
	if(regexmatches("$selection", "Extract clipboard to Archive-Name folder")) {end 1==1;}                 //end




/*	
//Extract selected items to Archive-Name folder in the last clicked item path
	if(regexmatches("$selection", "Extract selected items to Archive-Name folder in the last clicked item path")) {
	if($EXT != "\.zip" && $EXT != "\.rar" && $EXT != "\.7z") {msg "Only one format can be selected for this option!"; end 1==1;}
        run """D:\Program Files\WinRAR\WinRAR.exe"" e -o+ <selitems> ""<curitempath>\<curbase>\""";		      //Extract to Archive-Name folder	     Overwrite:"-o+"   Skip:"-o-"		 
	}
//View all items?
    if(regexmatches("$selection", "Extract selected items to Archive-Name folder in the last clicked item path")) {
	$count = gettoken($SI2, "count", <crlf>);
	 while ($selection == "Extract selected items to Archive-Name folder in the last clicked item path") {
    $confirm = inputselect("$count items extracted, View all extracted items?", "+View extracted item in the new tab,View extracted item <only folder in archive> in the new tab,+Move the folder up If only one Archive-Name folder in the archive,Set label of extracted item to grey,<Ask again in 5 seconds>", "," , "2", "cancel", "432", "252", "Tips", , ":fore-");	
     if(regexmatches($confirm, "<Ask again in 5 seconds>")) {wait 5000;}           //Wait 5S
     if(!regexmatches($confirm, "<Ask again in 5 seconds>")) {break;}
 }	 
            $curitempath = "<curitempath>";
			$curbase = "<curbase>";
			if($confirm == "cancel") {end 1==1;}
//Move the folder up If only one Archive-Name folder in the archive
    if(regexmatches("$confirm", "Move the folder up If only one Archive-Name folder in the archive")) {
           if(exists("<curitempath>\<curbase>\<curbase>\") == "2") {
           if(listfolder("<curitempath>\<curbase>\", "*.*", 1+4, <crlf>) == "") {
		   wait 300;
           moveto "<curitempath>\", "<curitempath>\<curbase>\<curbase>\";
           } 
           }
		   }
//View extracted item <only folder in archive> in the new tab
            if(regexmatches($confirm, "View extracted item <only folder in archive> in the new tab")) {			
			if(exists("$curitempath\$curbase\") == "2") {
			if(listfolder("$curitempath\$curbase\", "*.*", 1+4, <crlf>) == "") {
			tab('new',"$curitempath\$curbase\");
			}
			}
			}
//View extracted item in the new tab
			if(regexmatches($confirm, "View extracted item in the new tab") && !regexmatches($confirm, "View extracted item <only folder in archive> in the new tab")) {
			if(exists("$curitempath\$curbase\") == "2") {
			tab('new',"$curitempath");									
			wait "100";  //Interval Time
			selectitems "$curbase";
			}}
//Set label of extracted item to grey
            if(regexmatches($confirm, "Set label of extracted item to grey")) {
            tagitems("lbl", "7", "$curitempath\$curbase");
	}
}
	if(regexmatches("$selection", "Extract selected items to Archive-Name folder in the last clicked item path")) {end 1==1;}                 //end	
*/




//Extract selected items to Archive-Name folder
	if(regexmatches("$selection", "Extract selected items to Archive-Name folder")) {
	foreach($Item2, $SI2, "<crlf>") {
		if($Item2 == ""){ break; }
		if(strpos($Item2, "\", 0, 1) != "-1"){
			$Path = regexreplace($Item2, "(.*\\)(.*)", "$1");                                         //Get the path of each item
            $ItemName = regexreplace($Item2, "(.*\\)(.*)", "$2");                                     //Get the file name of each item
			$Base = regexreplace("$ItemName", "$EXT|", "", "|", 0, 1);                                //replace ext to get base name
			run """D:\Program Files\WinRAR\WinRAR.exe"" e -o+ ""$Item2"" ""$Path$Base\""";            //Extract to Archive-Name folder	     Overwrite:"-o+"   Skip:"-o-"
            wait "$Time";        //Interval Time
		} 
	}
}	
//View all items?
    if(regexmatches("$selection", "Extract selected items to Archive-Name folder")) {
	$count = gettoken($SI2, "count", <crlf>);
     while ($selection == "Extract selected items to Archive-Name folder") {
	$confirm = inputselect("$count items extracted, View all extracted items?", "+View all items in the paper folder <Show folder size>,+Move the folder up If only one Archive-Name folder in the archive,View each extracted item <only folder in archive> in the new tab,View each extracted item in the new tab,Set label of extracted item to grey,<Ask again in 5 seconds>", "," , "2", "cancel", "432", "271", "Tips", , ":fore-");
     if(regexmatches($confirm, "<Ask again in 5 seconds>")) {wait 5000;}           //Wait 5S
     if(!regexmatches($confirm, "<Ask again in 5 seconds>")) {break;}
 }	 
//View all items in the paper folder <Show folder size>	
			if(regexmatches($confirm, "View all items in the paper folder <Show folder size>")) {
			$confirm = replace("$confirm", "View each extracted item in the new tab", "");
			$name       = now("yyyy-mm-dd-hhnnss");									//Paper folder name
            $paper  		= "%temp%\EverythingForXYplorer\$name.txt";             //Paper folder path
            tab("new");                                                             //New tab
            paperfolder("$name", "$SI3<crlf>$SI2", , , "1");     				    //Open Paper folder
            if(get('#417') == "0") {#417;}                                          //Show folder size
            }					
	foreach($Item, $SI2, "<crlf>") {
		if($Item == ""){ break; }
		if(strpos($Item, "\", 0, 1) != "-1"){
			$Path = regexreplace($Item, "(.*\\)(.*)", "$1");                                           //Get the path of each item
			$ItemName = replace("$Item", "$Path");                                                     //Get the file name of each item
            $Base = regexreplace("$ItemName", "$EXT|", "", "|", 0, 1);                                 //replace ext to get base name
			if($confirm == "cancel") {end 1==1;}			
//Move the folder up If only one Archive-Name folder in the archive
    if(regexmatches("$confirm", "Move the folder up If only one Archive-Name folder in the archive")) {
           if(exists("$Path$Base\$Base\") == "2") {
           if(listfolder("$Path$Base\", "*.*", 1+4, <crlf>) == "") {
		   wait 300;
           moveto "$Path", "$Path$Base\$Base\";
           } 
           }
		   }
//View each extracted item <only folder in archive> in the new tab
			if(regexmatches($confirm, "View each extracted item <only folder in archive> in the new tab")) {			
			if(exists("$Path$Base\") == "2") {
			if(listfolder("$Path$Base\", "*.*", 1+4, <crlf>) == "") {
			tab('new',"$Path$Base");
			}
			}
			}
//View each extracted item in the new tab
			if(regexmatches($confirm, "View each extracted item in the new tab") && !regexmatches($confirm, "View each extracted item <only folder in archive> in the new tab")) {
			if(exists("$Path$Base\") == "2") {
			tab('new',"$Path");			
			wait "100";  //Interval Time
			selectitems "$Base";	                //Select the extracted item
			}}
//Set label of extracted item to grey			
			if(regexmatches($confirm, "Set label of extracted item to grey")) {
            tagitems("lbl", "7", "$Path$Base");
	  }
	 }
   }
}
	if(regexmatches("$selection", "Extract selected items to Archive-Name folder")) {end 1==1;}                 //end  





//Set Interval Time
    if(regexmatches("$selection", "Set Interval Time")) {
	$Time = input("Set Interval Time, In Milliseconds", , "$Time", "m", "cancel", "100", "500");
	if $Time == "cancel" {end 1==1;}
	setkey $Time, "Time", "Interval Time", $iniFile;          //Save Interval Time
	end 1==1;} 	

	 if $selection == "" {end 1==1;}
     load $selection, , "s";
	}
Single thread:

Code: Select all

/*
******************************************************************************
@Created : 2022-03-15
@Modified: 2022-05-10
@Function: [Bandizip Overwrite Mode]Extract selected items or clipboard to Archive-Name folder. [Single thread]. [View all items in the paper folder <Show folder size>, Move the folder up If only one Archive-Name folder in the archive, View each extracted item <only folder in archive> in the new tab, View each extracted item in the new tab, Set label of extracted item to grey]
@Version : v8.5
******************************************************************************
*/
/*
    //Handle .ini file
    $iniFile = self("path") . "\" . "INI" . "\" . self("base") . "Interval Time" . ".ini";

    //Write .ini file if missing
    if (exists($iniFile) != 1) {
        $iniContent = <<<'>>>'


//Interval Time
[Interval Time]
Time=3000


;The last query you've used
LastQuery=
        >>>;
        writefile($iniFile, $iniContent, , "tu");
    }



    //Get Interval time
    $Time     = getkey("Time",     "Interval Time", $iniFile);
*/


//Icons
	$iconCfi     = ":cfi"; 
	$icon2     = ":clip"; 
	$icon23     = ":#23";
	$icon36     = ":#36";
	$icon6     = ":udc";
	$count = get("CountSelected");  //CountSelected


//Parameters
    $menu   = "";
	set $SelectedItems, <clipboard>;              //Set $SelectedItems = Contents of the current clipboard
	$SI2 = get("SelectedItemsPathNames", "<crlf>", a);
    //$SI2 = replace($SI, "|", "<crlf>");
	$EXT = get("SelExt", "|");
	$EXT = replace($EXT, "*", "\");
	$SI3 = regexreplace("$SI2", "$EXT|", "", "|", 0, 1);


//Add Menu
            $menu = <crlf> . "-Extract selected items or clipboard to Archive-Name folder-        [$count items selected]" . "<:>" . "<:>" . $iconCfi;
			$menu2 .= <crlf> . "Extract clipboard to Archive-Name folder" . "<:>" . "<:>" . $icon2;						
			$menu3 = <crlf> . "Extract selected items to Archive-Name folder" . "<:>" . "<:>" . $icon36;	
            $menu5 = <crlf> . "Extract selected items to Archive-Name folder in the last clicked item path" . "<:>" . "<:>" . $icon23;
			//$menu6 = <crlf> . "Set Interval Time" . "<:>" . "<:>" . $icon6;

//Menus
    $selection = popupnested("$menu<crlf><:>$menu2<crlf>$menu3<crlf>$menu5", 6:=<crlf>, 7:="<:>");
	if ($selection) {
	if(regexmatches("$selection", "Extract selected items or clipboard to Archive-Name folder")) {end 1==1};





//Extract clipboard to Archive-Name folder	
	if(regexmatches("$selection", "Extract clipboard to Archive-Name folder")) {
	foreach($Item, $SelectedItems, "<crlf>") {
		if($Item == ""){ break; }
		if(strpos($Item, "\", 0, 1) != "-1"){
			$Path = regexreplace($Item, "(.*\\)(.*)", "$1");                                                     //Get the path of each item
			$ItemName = regexreplace($Item, "(.*\\)(.*)", "$2");                                                 //Get the file name of each item
			$Base = regexreplace("$ItemName", "\.zip|\.rar|\.7z|", "", "|", 0, 1);                               //replace ext to get base name
//Ask if .zip .rar .7z do not contain
	if(!regexmatches($Item, "\.zip")&&!regexmatches($Item, "\.rar")&&!regexmatches($Item, "\.7z")) {
	$confirm = confirm("Clipboard content does not contain .zip .rar .7z, continue?");
	if($confirm == "0") {end 1==1;}
     }			
			run """C:\Program Files\Bandizip\Bandizip.exe"" x -aoa -o:""$Path$Base"" ""$Item""", , 2, 2; //wait "$Time";  //Extract to Archive-Name folder	   Overwrite:"-aoa"   Skip:"-aos"
	} 
  }
}
//View all items?
    if(regexmatches("$selection", "Extract clipboard to Archive-Name folder")) {
	$count = gettoken($selection, "count", <crlf>);
     while ($selection == "Extract clipboard to Archive-Name folder") {
	$confirm = inputselect("$count items extracted, View all extracted items?", "+View all items in the paper folder <Show folder size>,+Move the folder up If only one Archive-Name folder in the archive,View each extracted item <only folder in archive> in the new tab,View each extracted item in the new tab,Set label of extracted item to grey,<Ask again in 5 seconds>", "," , "2", "cancel", "432", "271", "Tips", , ":fore-");
     if(regexmatches($confirm, "<Ask again in 5 seconds>")) {wait 5000;}           //Wait 5S
     if(!regexmatches($confirm, "<Ask again in 5 seconds>")) {break;}
 }
//View all items in the paper folder <Show folder size>		
			if(regexmatches($confirm, "View all items in the paper folder <Show folder size>")) {
			$confirm = replace("$confirm", "View each extracted item in the new tab", "");
			$name       = now("yyyy-mm-dd-hhnnss");									//Paper folder name
            $paper  		= "%temp%\EverythingForXYplorer\$name.txt";             //Paper folder path
            tab("new");                                                             //New tab
            paperfolder("$name", "$SI3<crlf>$SI2", , , "1");     					//Open Paper folder
            if(get('#417') == "0") {#417;}                                          //Show folder size
            }
		foreach($Item, $SelectedItems, "<crlf>") {
		    if($Item == ""){ break; }
		    if(strpos($Item, "\", 0, 1) != "-1"){
			$Path = regexreplace($Item, "(.*\\)(.*)", "$1");
			$ItemName = replace("$Item", "$Path");
            $Base = regexreplace("$ItemName", "\.zip|\.rar|\.7z|", "", "|", 0, 1); //replace ext to get base name
			if($confirm == "cancel") {end 1==1;}			
//Move the folder up If only one Archive-Name folder in the archive
    if(regexmatches("$confirm", "Move the folder up If only one Archive-Name folder in the archive")) {
           if(exists("$Path$Base\$Base\") == "2") {
           if(listfolder("$Path$Base\", "*.*", 1+4, <crlf>) == "") {
		   wait 300;
           moveto "$Path", "$Path$Base\$Base\";
           } 
           }
	       }
//View each extracted item <only folder in archive> in the new tab
			if(regexmatches($confirm, "View each extracted item <only folder in archive> in the new tab")) {			
			if(exists("$Path$Base\") == "2") {
			if(listfolder("$Path$Base\", "*.*", 1+4, <crlf>) == "") {
			tab('new',"$Path$Base");
			}
			}
			}
//View each extracted item in the new tab
			if(regexmatches($confirm, "View each extracted item in the new tab") && !regexmatches($confirm, "View each extracted item <only folder in archive> in the new tab")) {
			if(exists("$Path$Base\") == "2") {
			tab('new',"$Path");
			wait "100";  //Interval Time
			selectitems "$Base";
            }}
//Set label of extracted item to grey
			if(regexmatches($confirm, "Set label of extracted item to grey")) {
            tagitems("lbl", "7", "$Path\$Base");
	        }
    }
  }
}
	if(regexmatches("$selection", "Extract clipboard to Archive-Name folder")) {end 1==1;}                 //end




	
//Extract selected items to Archive-Name folder in the last clicked item path
	if(regexmatches("$selection", "Extract selected items to Archive-Name folder in the last clicked item path")) {
	if($EXT != "\.zip" && $EXT != "\.rar" && $EXT != "\.7z") {msg "Only one format can be selected for this option!"; end 1==1;}
		run """C:\Program Files\Bandizip\Bandizip.exe"" bx -aoa -o:""<curitempath>\<curbase>"" <selitems>", , 2, 2;                      //Extract to Archive-Name folder	   Overwrite:"-aoa"   Skip:"-aos"					 
	}
//View all items?
    if(regexmatches("$selection", "Extract selected items to Archive-Name folder in the last clicked item path")) {
	$count = gettoken($SI2, "count", <crlf>);
	 while ($selection == "Extract selected items to Archive-Name folder in the last clicked item path") {
    $confirm = inputselect("$count items extracted, View all extracted items?", "+View extracted item in the new tab,View extracted item <only folder in archive> in the new tab,+Move the folder up If only one Archive-Name folder in the archive,Set label of extracted item to grey,<Ask again in 5 seconds>", "," , "2", "cancel", "432", "252", "Tips", , ":fore-");	
     if(regexmatches($confirm, "<Ask again in 5 seconds>")) {wait 5000;}           //Wait 5S
     if(!regexmatches($confirm, "<Ask again in 5 seconds>")) {break;}
 }	 
            $curitempath = "<curitempath>";
			$curbase = "<curbase>";
			if($confirm == "cancel") {end 1==1;}
//Move the folder up If only one Archive-Name folder in the archive
    if(regexmatches("$confirm", "Move the folder up If only one Archive-Name folder in the archive")) {
           if(exists("<curitempath>\<curbase>\<curbase>\") == "2") {
           if(listfolder("<curitempath>\<curbase>\", "*.*", 1+4, <crlf>) == "") {
		   wait 300;
           moveto "<curitempath>\", "<curitempath>\<curbase>\<curbase>\";
           } 
           }
		   }
//View extracted item <only folder in archive> in the new tab
            if(regexmatches($confirm, "View extracted item <only folder in archive> in the new tab")) {
			if(exists("$curitempath\$curbase\") == "2") {
			if(listfolder("$curitempath\$curbase\", "*.*", 1+4, <crlf>) == "") {
			tab('new',"$curitempath\$curbase\");
			}
			}
			}
//View extracted item in the new tab
			if(regexmatches($confirm, "View extracted item in the new tab") && !regexmatches($confirm, "View extracted item <only folder in archive> in the new tab")) {
			if(exists("$curitempath\$curbase\") == "2") {
			tab('new',"$curitempath");									
			wait "100";  //Interval Time
			selectitems "$curbase";
			}}
//Set label of extracted item to grey
            if(regexmatches($confirm, "Set label of extracted item to grey")) {
            tagitems("lbl", "7", "$curitempath\$curbase");
	}
}
	if(regexmatches("$selection", "Extract selected items to Archive-Name folder in the last clicked item path")) {end 1==1;}                 //end	





//Extract selected items to Archive-Name folder
	if(regexmatches("$selection", "Extract selected items to Archive-Name folder")) {
	foreach($Item2, $SI2, "<crlf>") {
		if($Item2 == ""){ break; }
		if(strpos($Item2, "\", 0, 1) != "-1"){
			$Path = regexreplace($Item2, "(.*\\)(.*)", "$1");                                         //Get the path of each item
            $ItemName = regexreplace($Item2, "(.*\\)(.*)", "$2");                                     //Get the file name of each item
			$Base = regexreplace("$ItemName", "$EXT|", "", "|", 0, 1);                                //replace ext to get base name
			run """C:\Program Files\Bandizip\Bandizip.exe"" x -aoa -o:""$Path$Base"" ""$Item2""", , 2, 2;     //Extract to Archive-Name folder	   Overwrite:"-aoa"   Skip:"-aos"
            //wait "$Time";        //Interval Time
		} 
	}
}	
//View all items?
    if(regexmatches("$selection", "Extract selected items to Archive-Name folder")) {
	$count = gettoken($SI2, "count", <crlf>);
     while ($selection == "Extract selected items to Archive-Name folder") {
	$confirm = inputselect("$count items extracted, View all extracted items?", "+View all items in the paper folder <Show folder size>,+Move the folder up If only one Archive-Name folder in the archive,View each extracted item <only folder in archive> in the new tab,View each extracted item in the new tab,Set label of extracted item to grey,<Ask again in 5 seconds>", "," , "2", "cancel", "432", "271", "Tips", , ":fore-");
     if(regexmatches($confirm, "<Ask again in 5 seconds>")) {wait 5000;}           //Wait 5S
     if(!regexmatches($confirm, "<Ask again in 5 seconds>")) {break;}
 }	 
//View all items in the paper folder <Show folder size>	
			if(regexmatches($confirm, "View all items in the paper folder <Show folder size>")) {
			$confirm = replace("$confirm", "View each extracted item in the new tab", "");
			$name       = now("yyyy-mm-dd-hhnnss");									//Paper folder name
            $paper  		= "%temp%\EverythingForXYplorer\$name.txt";             //Paper folder path
            tab("new");                                                             //New tab
            paperfolder("$name", "$SI3<crlf>$SI2", , , "1");     				    //Open Paper folder
            if(get('#417') == "0") {#417;}                                          //Show folder size
            }					
	foreach($Item, $SI2, "<crlf>") {
		if($Item == ""){ break; }
		if(strpos($Item, "\", 0, 1) != "-1"){
			$Path = regexreplace($Item, "(.*\\)(.*)", "$1");                                           //Get the path of each item
			$ItemName = replace("$Item", "$Path");                                                     //Get the file name of each item
            $Base = regexreplace("$ItemName", "$EXT|", "", "|", 0, 1);                                 //replace ext to get base name
			if($confirm == "cancel") {end 1==1;}			
//Move the folder up If only one Archive-Name folder in the archive
    if(regexmatches("$confirm", "Move the folder up If only one Archive-Name folder in the archive")) {
           if(exists("$Path$Base\$Base\") == "2") {
           if(listfolder("$Path$Base\", "*.*", 1+4, <crlf>) == "") {
		   wait 300;
           moveto "$Path", "$Path$Base\$Base\";
           } 
           }
		   }
//View each extracted item <only folder in archive> in the new tab
			if(regexmatches($confirm, "View each extracted item <only folder in archive> in the new tab")) {
			if(exists("$Path$Base\") == "2") {
			if(listfolder("$Path$Base\", "*.*", 1+4, <crlf>) == "") {
			tab('new',"$Path$Base");
			}
			}
			}
//View each extracted item in the new tab
			if(regexmatches($confirm, "View each extracted item in the new tab") && !regexmatches($confirm, "View each extracted item <only folder in archive> in the new tab")) {
			if(exists("$Path$Base\") == "2") {			tab('new',"$Path");			
			wait "100";  //Interval Time
			selectitems "$Base";	                //Select the extracted item
			}}
//Set label of extracted item to grey			
			if(regexmatches($confirm, "Set label of extracted item to grey")) {
            tagitems("lbl", "7", "$Path$Base");
	  }
	 }
   }
}
	if(regexmatches("$selection", "Extract selected items to Archive-Name folder")) {end 1==1;}                 //end  




/*
//Set Interval Time
    if(regexmatches("$selection", "Set Interval Time")) {
	$Time = input("Set Interval Time, In Milliseconds", , "$Time", "m", "cancel", "100", "500");
	if $Time == "cancel" {end 1==1;}
	setkey $Time, "Time", "Interval Time", $iniFile;          //Save Interval Time
	end 1==1;} 	
*/
	 if $selection == "" {end 1==1;}
     load $selection, , "s";
	}

Code: Select all

/*
******************************************************************************
@Created : 2022-03-15
@Modified: 2022-05-10
@Function: [WinRAR Overwrite Mode]Extract selected items or clipboard to Archive-Name folder. [Single thread]. [View all items in the paper folder <Show folder size>, Move the folder up If only one Archive-Name folder in the archive, View each extracted item <only folder in archive> in the new tab, View each extracted item in the new tab, Set label of extracted item to grey]
@Version : v8.5
******************************************************************************
*/
/*
    //Handle .ini file
    $iniFile = self("path") . "\" . "INI" . "\" . self("base") . "Interval Time" . ".ini";

    //Write .ini file if missing
    if (exists($iniFile) != 1) {
        $iniContent = <<<'>>>'


//Interval Time
[Interval Time]
Time=3000


;The last query you've used
LastQuery=
        >>>;
        writefile($iniFile, $iniContent, , "tu");
    }



    //Get Interval time
    $Time     = getkey("Time",     "Interval Time", $iniFile);
*/


//Icons
	$iconCfi     = ":cfi"; 
	$icon2     = ":clip"; 
	$icon23     = ":#23";
	$icon36     = ":#36";
	$icon6     = ":udc";
	$count = get("CountSelected");  //CountSelected


//Parameters
    $menu   = "";
	set $SelectedItems, <clipboard>;              //Set $SelectedItems = Contents of the current clipboard
	$SI2 = get("SelectedItemsPathNames", "<crlf>", a);
    //$SI2 = replace($SI, "|", "<crlf>");
	$EXT = get("SelExt", "|");
	$EXT = replace($EXT, "*", "\");
	$SI3 = regexreplace("$SI2", "$EXT|", "", "|", 0, 1);


//Add Menu
            $menu = <crlf> . "-Extract selected items or clipboard to Archive-Name folder-        [$count items selected]" . "<:>" . "<:>" . $iconCfi;
			$menu2 .= <crlf> . "Extract clipboard to Archive-Name folder" . "<:>" . "<:>" . $icon2;						
			$menu3 = <crlf> . "Extract selected items to Archive-Name folder" . "<:>" . "<:>" . $icon36;	
            //$menu5 = <crlf> . "Extract selected items to Archive-Name folder in the last clicked item path" . "<:>" . "<:>" . $icon23;
			//$menu6 = <crlf> . "Set Interval Time" . "<:>" . "<:>" . $icon6;

//Menus
    $selection = popupnested("$menu<crlf><:>$menu2<crlf>$menu3", 6:=<crlf>, 7:="<:>");
	if ($selection) {
	if(regexmatches("$selection", "Extract selected items or clipboard to Archive-Name folder")) {end 1==1};





//Extract clipboard to Archive-Name folder	
	if(regexmatches("$selection", "Extract clipboard to Archive-Name folder")) {
	foreach($Item, $SelectedItems, "<crlf>") {
		if($Item == ""){ break; }
		if(strpos($Item, "\", 0, 1) != "-1"){
			$Path = regexreplace($Item, "(.*\\)(.*)", "$1");                                                     //Get the path of each item
			$ItemName = regexreplace($Item, "(.*\\)(.*)", "$2");                                                 //Get the file name of each item
			$Base = regexreplace("$ItemName", "\.zip|\.rar|\.7z|", "", "|", 0, 1);                               //replace ext to get base name
//Ask if .zip .rar .7z do not contain
	if(!regexmatches($Item, "\.zip")&&!regexmatches($Item, "\.rar")&&!regexmatches($Item, "\.7z")) {
	$confirm = confirm("Clipboard content does not contain .zip .rar .7z, continue?");
	if($confirm == "0") {end 1==1;}
     }			
            run """D:\Program Files\WinRAR\WinRAR.exe"" e -o+ ""$Item"" ""$Path$Base\""", , 2, 2; //wait "$Time";		                 //Extract to Archive-Name folder	     Overwrite:"-o+"   Skip:"-o-"
	} 
  }
}
//View all items?
    if(regexmatches("$selection", "Extract clipboard to Archive-Name folder")) {
	$count = gettoken($selection, "count", <crlf>);
     while ($selection == "Extract clipboard to Archive-Name folder") {
	$confirm = inputselect("$count items extracted, View all extracted items?", "+View all items in the paper folder <Show folder size>,+Move the folder up If only one Archive-Name folder in the archive,View each extracted item <only folder in archive> in the new tab,View each extracted item in the new tab,Set label of extracted item to grey,<Ask again in 5 seconds>", "," , "2", "cancel", "432", "271", "Tips", , ":fore-");
     if(regexmatches($confirm, "<Ask again in 5 seconds>")) {wait 5000;}           //Wait 5S
     if(!regexmatches($confirm, "<Ask again in 5 seconds>")) {break;}
 }
//View all items in the paper folder <Show folder size>		
			if(regexmatches($confirm, "View all items in the paper folder <Show folder size>")) {
			$confirm = replace("$confirm", "View each extracted item in the new tab", "");
			$name       = now("yyyy-mm-dd-hhnnss");									//Paper folder name
            $paper  		= "%temp%\EverythingForXYplorer\$name.txt";             //Paper folder path
            tab("new");                                                             //New tab
            paperfolder("$name", "$SI3<crlf>$SI2", , , "1");     					//Open Paper folder
            if(get('#417') == "0") {#417;}                                          //Show folder size
            }
		foreach($Item, $SelectedItems, "<crlf>") {
		    if($Item == ""){ break; }
		    if(strpos($Item, "\", 0, 1) != "-1"){
			$Path = regexreplace($Item, "(.*\\)(.*)", "$1");
			$ItemName = replace("$Item", "$Path");
            $Base = regexreplace("$ItemName", "\.zip|\.rar|\.7z|", "", "|", 0, 1); //replace ext to get base name
			if($confirm == "cancel") {end 1==1;}			
//Move the folder up If only one Archive-Name folder in the archive
    if(regexmatches("$confirm", "Move the folder up If only one Archive-Name folder in the archive")) {
           if(exists("$Path$Base\$Base\") == "2") {
           if(listfolder("$Path$Base\", "*.*", 1+4, <crlf>) == "") {
		   wait 300;
           moveto "$Path", "$Path$Base\$Base\";
           } 
           }
	       }
//View each extracted item <only folder in archive> in the new tab
			if(regexmatches($confirm, "View each extracted item <only folder in archive> in the new tab")) {			
			if(exists("$Path$Base\") == "2") {
			if(listfolder("$Path$Base\", "*.*", 1+4, <crlf>) == "") {
			tab('new',"$Path$Base");
			}
			}
			}
//View each extracted item in the new tab
			if(regexmatches($confirm, "View each extracted item in the new tab") && !regexmatches($confirm, "View each extracted item <only folder in archive> in the new tab")) {
			if(exists("$Path$Base\") == "2") {
			tab('new',"$Path");
			wait "100";  //Interval Time
			selectitems "$Base";
            }}
//Set label of extracted item to grey
			if(regexmatches($confirm, "Set label of extracted item to grey")) {
            tagitems("lbl", "7", "$Path\$Base");
	        }
   }
  }
}
	if(regexmatches("$selection", "Extract clipboard to Archive-Name folder")) {end 1==1;}                 //end




/*	
//Extract selected items to Archive-Name folder in the last clicked item path
	if(regexmatches("$selection", "Extract selected items to Archive-Name folder in the last clicked item path")) {
	if($EXT != "\.zip" && $EXT != "\.rar" && $EXT != "\.7z") {msg "Only one format can be selected for this option!"; end 1==1;}
        run """D:\Program Files\WinRAR\WinRAR.exe"" e -o+ <selitems> ""<curitempath>\<curbase>\""", , 2, 2;		      //Extract to Archive-Name folder	     Overwrite:"-o+"   Skip:"-o-"		 
	}
//View all items?
    if(regexmatches("$selection", "Extract selected items to Archive-Name folder in the last clicked item path")) {
	$count = gettoken($SI2, "count", <crlf>);
	 while ($selection == "Extract selected items to Archive-Name folder in the last clicked item path") {
    $confirm = inputselect("$count items extracted, View all extracted items?", "+View extracted item in the new tab,View extracted item <only folder in archive> in the new tab,+Move the folder up If only one Archive-Name folder in the archive,Set label of extracted item to grey,<Ask again in 5 seconds>", "," , "2", "cancel", "432", "252", "Tips", , ":fore-");	
     if(regexmatches($confirm, "<Ask again in 5 seconds>")) {wait 5000;}           //Wait 5S
     if(!regexmatches($confirm, "<Ask again in 5 seconds>")) {break;}
 }	 
            $curitempath = "<curitempath>";
			$curbase = "<curbase>";
			if($confirm == "cancel") {end 1==1;}
//Move the folder up If only one Archive-Name folder in the archive
    if(regexmatches("$confirm", "Move the folder up If only one Archive-Name folder in the archive")) {
           if(exists("<curitempath>\<curbase>\<curbase>\") == "2") {
           if(listfolder("<curitempath>\<curbase>\", "*.*", 1+4, <crlf>) == "") {
		   wait 300;
           moveto "<curitempath>\", "<curitempath>\<curbase>\<curbase>\";
           } 
           }
		   }
//View extracted item <only folder in archive> in the new tab
            if(regexmatches($confirm, "View extracted item <only folder in archive> in the new tab")) {			
			if(exists("$curitempath\$curbase\") == "2") {
			if(listfolder("$curitempath\$curbase\", "*.*", 1+4, <crlf>) == "") {
			tab('new',"$curitempath\$curbase\");
			}
			}
			}
//View extracted item in the new tab
			if(regexmatches($confirm, "View extracted item in the new tab") && !regexmatches($confirm, "View extracted item <only folder in archive> in the new tab")) {
			if(exists("$curitempath\$curbase\") == "2") {
			tab('new',"$curitempath");									
			wait "100";  //Interval Time
			selectitems "$curbase";
			}}
//Set label of extracted item to grey
            if(regexmatches($confirm, "Set label of extracted item to grey")) {
            tagitems("lbl", "7", "$curitempath\$curbase");
	}
}
	if(regexmatches("$selection", "Extract selected items to Archive-Name folder in the last clicked item path")) {end 1==1;}                 //end	
*/




//Extract selected items to Archive-Name folder
	if(regexmatches("$selection", "Extract selected items to Archive-Name folder")) {
	foreach($Item2, $SI2, "<crlf>") {
		if($Item2 == ""){ break; }
		if(strpos($Item2, "\", 0, 1) != "-1"){
			$Path = regexreplace($Item2, "(.*\\)(.*)", "$1");                                         //Get the path of each item
            $ItemName = regexreplace($Item2, "(.*\\)(.*)", "$2");                                     //Get the file name of each item
			$Base = regexreplace("$ItemName", "$EXT|", "", "|", 0, 1);                                //replace ext to get base name
			run """D:\Program Files\WinRAR\WinRAR.exe"" e -o+ ""$Item2"" ""$Path$Base\""", , 2, 2;            //Extract to Archive-Name folder	     Overwrite:"-o+"   Skip:"-o-"
            //wait "$Time";        //Interval Time
		} 
	}
}	
//View all items?
    if(regexmatches("$selection", "Extract selected items to Archive-Name folder")) {
	$count = gettoken($SI2, "count", <crlf>);
     while ($selection == "Extract selected items to Archive-Name folder") {
	$confirm = inputselect("$count items extracted, View all extracted items?", "+View all items in the paper folder <Show folder size>,+Move the folder up If only one Archive-Name folder in the archive,View each extracted item <only folder in archive> in the new tab,View each extracted item in the new tab,Set label of extracted item to grey,<Ask again in 5 seconds>", "," , "2", "cancel", "432", "271", "Tips", , ":fore-");
     if(regexmatches($confirm, "<Ask again in 5 seconds>")) {wait 5000;}           //Wait 5S
     if(!regexmatches($confirm, "<Ask again in 5 seconds>")) {break;}
 }	 
//View all items in the paper folder <Show folder size>	
			if(regexmatches($confirm, "View all items in the paper folder <Show folder size>")) {
			$confirm = replace("$confirm", "View each extracted item in the new tab", "");
			$name       = now("yyyy-mm-dd-hhnnss");									//Paper folder name
            $paper  		= "%temp%\EverythingForXYplorer\$name.txt";             //Paper folder path
            tab("new");                                                             //New tab
            paperfolder("$name", "$SI3<crlf>$SI2", , , "1");     				    //Open Paper folder
            if(get('#417') == "0") {#417;}                                          //Show folder size
            }					
	foreach($Item, $SI2, "<crlf>") {
		if($Item == ""){ break; }
		if(strpos($Item, "\", 0, 1) != "-1"){
			$Path = regexreplace($Item, "(.*\\)(.*)", "$1");                                           //Get the path of each item
			$ItemName = replace("$Item", "$Path");                                                     //Get the file name of each item
            $Base = regexreplace("$ItemName", "$EXT|", "", "|", 0, 1);                                 //replace ext to get base name
			if($confirm == "cancel") {end 1==1;}			
//Move the folder up If only one Archive-Name folder in the archive
    if(regexmatches("$confirm", "Move the folder up If only one Archive-Name folder in the archive")) {
           if(exists("$Path$Base\$Base\") == "2") {
           if(listfolder("$Path$Base\", "*.*", 1+4, <crlf>) == "") {
		   wait 300;
           moveto "$Path", "$Path$Base\$Base\";
           } 
           }
		   }
//View each extracted item <only folder in archive> in the new tab
			if(regexmatches($confirm, "View each extracted item <only folder in archive> in the new tab")) {			
			if(exists("$Path$Base\") == "2") {
			if(listfolder("$Path$Base\", "*.*", 1+4, <crlf>) == "") {
			tab('new',"$Path$Base");
			}
			}
			}
//View each extracted item in the new tab
			if(regexmatches($confirm, "View each extracted item in the new tab") && !regexmatches($confirm, "View each extracted item <only folder in archive> in the new tab")) {
			if(exists("$Path$Base\") == "2") {
			tab('new',"$Path");			
			wait "100";  //Interval Time
			selectitems "$Base";	                //Select the extracted item
			}}
//Set label of extracted item to grey			
			if(regexmatches($confirm, "Set label of extracted item to grey")) {
            tagitems("lbl", "7", "$Path$Base");
	  }
	 }
   }
}
	if(regexmatches("$selection", "Extract selected items to Archive-Name folder")) {end 1==1;}                 //end  




/*
//Set Interval Time
    if(regexmatches("$selection", "Set Interval Time")) {
	$Time = input("Set Interval Time, In Milliseconds", , "$Time", "m", "cancel", "100", "500");
	if $Time == "cancel" {end 1==1;}
	setkey $Time, "Time", "Interval Time", $iniFile;          //Save Interval Time
	end 1==1;} 	
*/
	 if $selection == "" {end 1==1;}
     load $selection, , "s";
	}
Last edited by Norn on 01 Feb 2023 15:38, edited 5 times in total.
Windows 11 24H2 @100% 2560x1440

Horst
Posts: 1374
Joined: 24 Jan 2021 12:27
Location: Germany

Re: Extract selected items to Archive-Name folder...

Post by Horst »

I use a very simple script which unpacks into the inactive pane.
Thats for me the way unpacking should work and its made this way by most 2-pane file managers.

Code: Select all

// Extracts the selected archive(s) to the inactive pane using 7-Zip.

// Check if there's at least one (archive) file selected

   $selected    = <get SelectedItemsPathNamesSlashed>;
   $cntSelected = gettoken($selected, "count", <crlf>);
   end ($cntSelected == 0), "No (archive) file(s) selected, aborted!";

   $cntFiles = gettoken(formatlist($selected, "f", <crlf>, "!*\"), "count", <crlf>);
   end ($cntSelected != $cntFiles), "Folder(s) can't be selected, aborted!";

   foreach($item, $selected, <crlf>, "e") {
        if (exists($item) == 2) { continue; }

    $other = get("path", i) . "\";
    Run("""C:\Program Files\7-Zip\7zG.exe"" x ""$item"" -o""$other""");
    };

Windows 11 Home, Version 25H2 (OS Build 26200.8457)
Portable x64 XYplorer (Actual version, including betas)
Display settings 1920 x 1080 Scale 100%
Everything 1.5.0.1412b (x64), Everything Toolbar 2.3.0, Listary Pro 6.3.6.99

Norn
Posts: 504
Joined: 24 Oct 2021 16:10

Re: Extract selected items to Archive-Name folder...

Post by Norn »

Smart archive extraction (enhanced):
Smart achive extraction.png
Smart achive extraction2.png
Bandizip
Smart archive extraction (enhanced) v8.6.1 (Bandizip).xys
Smart archive extraction (enhanced) v8.6 (Bandizip).xys
WinRAR
Smart archive extraction (enhanced) v8.6 (WinRAR).xys
You do not have the required permissions to view the files attached to this post.
Windows 11 24H2 @100% 2560x1440

Post Reply