WinRAR Suite

Discuss and share scripts and script files...
Post Reply
tiago
Posts: 589
Joined: 14 Feb 2011 21:41

WinRAR Suite

Post by tiago »

As it took me a time to achieve what I wanted I think it worths sharing this one as my forum searches came up with nothing. This may be due to it being so easy to experienced users, which I'm not.
! Adding files will use "-ep1" parameter which will exclude base paths.
TheQwerty's lesson on quoting helped on this one.
I thought on adding icons but this is a matter of personal taste so I left the job for you.

Code: Select all

"Add Files to RAR pack"
   $pt = get(selecteditemspathnames); $L = ""; $hour = format(<date>, "hh-nn-ss"); foreach($file, $pt, "<crlf>") { $file = quote("$file"); $L = " " . "$file" . "$L"; } run winrar a "-ep1" newRAR$hour $L;
"Extract RAR pack as it is"
   run winrar x "<curitem>";
"Extract RAR packs to Subfolder"
   $hour = format(<date>, "hh-nn-ss"); run winrar x "<curitem>" Unpacked$hour\;
Power-hungry user!!!

totmad1
Posts: 131
Joined: 24 Jun 2013 12:37

Re: WinRAR Suite

Post by totmad1 »

Found this and thought I would try to update (2011?).
Listing will only work on rar files. Rather dissapointing.

Code: Select all

"_Initialize";
        perm $p_rar = "C:\Users\user\Documents\portaprogs\rar\rar.exe";
"Add Files to RAR pack"
   $pt = get(selecteditemspathnames);
    $L = ""; $hour = format(<date>, "hh-nn-ss");
     foreach($file, $pt, "<crlf>") { $file = quote("$file");
      $L = " " . "$file" . "$L";
       } run $p_rar a "-ep1" newRAR$hour $L;
"Extract RAR pack as it is"
   run $p_rar x "<curitem>";
"Extract RAR packs to Subfolder"
   $hour = format(<date>, "hh-nn-ss"); run $p_rar x "<curitem>" Unpacked$hour\;
"-"
"List <curname> (only rar files)"
               run ( "cmd /c $p_rar l ""<curitem>"" > archive1.txt");
"List ALL in folder (only rar files)"
                  run ( "cmd /c $p_rar l * > archive1.txt");

-
"Edit script : edit"
           $ScriptFile= self ("file");
	    run "$p_note" $ScriptFile , w;
-
"Cancel"
"_Terminate";
       unset $p_rar;
totmad1 (totally mad one)
totmad1 (totally mad one)

40k
Posts: 234
Joined: 09 Dec 2011 21:25

Re: WinRAR Suite

Post by 40k »

Code: Select all

/* RAR scripts */

///////////////////////////////////////////////////////////////////////
//// START Individually compress files and folders		           ////
///////////////////////////////////////////////////////////////////////
"Individually compress files and folders"
 $filelist="";													 //Selected files ItemPathNames.
 $unique="";													 //Represents one resultant archive. Either file or folder.
 $rarpath="C:\Program Files\Winrar\Winrar.exe"; 							 //RAR executable
 $rarname="";													 //RAR unique name	
 $rarcommand="";												 //RAR command line to archive one file or folder 
 $timestamp="<date yymmdd+hhnnss>";				//current time used to make filename unique
 //Get ItemPathNames for all selected files
 $filelist = get("SelectedItemsPathNames",|,);
 //For each ItemPathName write a RAR command line
 foreach($unique,$filelist,|) {
  $rarname = getpathcomponent($unique,"file",);
  $RarCommand = '"'.$rarpath.'" a "'.$rarname.' '.$timestamp.'.rar" "'.$rarname.'"'; 
  writefile("RAR.bat",$RarCommand."<crlf>",a);
 }
  writefile("RAR.bat", "del RAR.bat",a);
  run ("RAR.bat", , 0, 0);
This old code will create individual RAR archives of all the files you have selected. Archives are timestamped to create unique file names. Use it to quickly make a backup of a document you are working on.
I develop scripts that integrate media functionality into Xyplorer.
Hash - Twitch.tv in VLC (NEW 2.0!) - FFmpeg GUI - Youtube downloading
XYplorer for Linux! Tutorial

totmad1
Posts: 131
Joined: 24 Jun 2013 12:37

Re: WinRAR Suite

Post by totmad1 »

Worked out a "dirty" way to extract to other pane

Code: Select all

"Extract RAR packs to Subfolder and move to other pane"
         // This is a real "dirty" way to do this
    $a =  get("path", i);
    run $p_rar x "<curitem>" Unpacked\;
          wait 1000;
      selfilter Unpacked , d;
    moveto $a , <curitem> ;
Of course you could try to get hour code in. Tried to myself but not stable.

totmad1(totally mad one)
totmad1 (totally mad one)

Post Reply