open with winrar

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Ysl
Posts: 164
Joined: 03 Jan 2007 22:22

open with winrar

Post by Ysl »

Hi

I need your help please

I would like to make a UDC "open with" winrar with a command line which will made me able to push a key to un-rar the selected archive in a folder (in the same folder as the archive with the same name as the archive) and no folder if the archive is just 1 file..

In fact just like right clicking on the archive and select winRar/Extrat to folder

Is this possible ? (But what is impossible with XYplorer ?)

Thanks

zer0
Posts: 2676
Joined: 19 Jan 2009 20:11

Re: open with winrar

Post by zer0 »

Ysl wrote:I would like to make a UDC "open with" winrar with a command line which will made me able to push a key to un-rar the selected archive in a folder (in the same folder as the archive with the same name as the archive) and no folder if the archive is just 1 file..

In fact just like right clicking on the archive and select winRar/Extrat to folder
First things first. The bit that I highlighted in red equals to what you're asking in the blue text. Green functionality cannot be achieved by the red text, because WinRAR cannot, AFAK, behave differently, in terms of extraction, depending on the number of files in an archive you're trying to extract.

In general, the template for a WinRAR command is as follows:

Code: Select all

WinRAR <command> -<switch1> -<switchN> <archive> <files...> <@listfiles...> <path_to_extract>
In your case, I'd think the following script command will suffice:

Code: Select all

"Extract Here" Set($cf,<curfolder>);
 OpenWith("""C:\program files\winrar\winrar.exe"" e -ad -- <curitem> * $cf", "s");
Obviously, you'll have to replace the path to WinRAR with the correct one for your system and substitute "x" for "e" if you want full paths extracted. That script will do the job you're asking for in the blue and the red text. If you want a script that also does the green job then it's more complicated, because after extraction the script will have to go to the folder, check the quantity of items and if that number is =1 then move it up a level in the tree. But no, it's not impossible :mrgreen:

Let me know how it works :wink:
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build

Ysl
Posts: 164
Joined: 03 Jan 2007 22:22

Re: open with winrar

Post by Ysl »

Thank you my friend for replying, your help is always greatly appreciated !

I changed a very little bit the script because it wasn't working : (I had 2 choice on the screen when pushing the key : Extract here and Open with....

"Extract Here" Set($cf,<curfolder>);OpenWith("""C:\Program Files\WinRAR\WinRAR.exe"" e -ad -- <curitem> * $cf", "s");

It worked once...! Don't know why but now, I have the error message "No archive found" (in french !) with any other rar or zip files

And let's forget about the green text !

Ysl

zer0
Posts: 2676
Joined: 19 Jan 2009 20:11

Re: open with winrar

Post by zer0 »

About the not working part, this is partly my fault for not mentioning and partly the forum software for not displaying what I've pasted properly. As per http://88.191.26.34/XYwiki/index.php/Sc ... Multi-line, you need a space at the beginning of a new line of the same script for it to be treated as part of that script. Screen below shows that:
code.png
See the space between the edit cursor (vertical line) and then "OpenWith..." part? That's what I mean.

About the "No archive found" part, that's strange. You do need to have an archive selected for the script to work. It's possible that the archives you're trying to extract are corrupted, because I remember encountering such an issue in the past. Whatever the reason for this error message, it's not to do with XYplorer because the script does its job, so it's over to WinRAR to do its duties.

Can you please provide some more information like screenshot(s)? A picture tells a thousand words... :P
To see the attached files, you need to log into the forum.
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build

Ysl
Posts: 164
Joined: 03 Jan 2007 22:22

Re: open with winrar

Post by Ysl »

Thanks ! What seemed simple at first is taking some headache...

I use now your script with the space and I do no more have 2 lines when pushing the key but I still have the WinRar message "no archive found"

Tried many .rar and .zip and several hdd location (root directory or not)

Tried several setting in Winrar but to no avail....

What's the use of the "s" at the end of the script ?

Thanks again for your help
Last edited by Ysl on 09 Aug 2009 22:51, edited 1 time in total.

zer0
Posts: 2676
Joined: 19 Jan 2009 20:11

Re: open with winrar

Post by zer0 »

Ysl wrote:What's the use of the "s" at the end of the script ?
It identifies how many instances of that application are to be used. "S" stands for single, "M" for multiple. If you have several different RARs and want to unpack them at the same time then use "m" instead of "s". It will open several instances of your archiving application and do the job.

Regarding your error message, there's little help I can provide, because it seems the problem is between WinRAR and your files. You can try to search on the web for what can cause that sort of error message, but that's as much as I can suggest.
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: open with winrar

Post by jacky »

Try this:

Code: Select all

"Extract here"
  openwith """WinRAR"" x -- <items>", m;
"Extract Each to Subfolder"
  openwith """WinRAR"" x -ad -- <items>", m;
Proud XYplorer Fanatic

Ysl
Posts: 164
Joined: 03 Jan 2007 22:22

Re: open with winrar

Post by Ysl »

Hey, this one seems to work very well !!!

Thank you to both of you for you help !

Ysl

Post Reply