Extractor - Extract, cleanup and delete archives

Discuss and share scripts and script files...
klownboy
Posts: 4052
Joined: 28 Feb 2012 19:27

Re: Extractor - Extract, cleanup and delete archives

Post by klownboy »

highend wrote:It's an interesting way to control an application just by not releasing a modifier key. The only thing that really annoys me is that it's storing duplicates of already copied items That "pollutes" the clip and history cache...
It's a very nice feature once you're used to it along with cancelling out of paste with the "X". He's made many of improvements since he originally posted it. Maybe at some point, it will sink in, that dupes are unnecessary as well as a waste of history and space. In reviewing your last post there, I see you mentioned that the duplicate adjacent clips does not work and you're right even with 7.7b1.

I thought I had already set the recursive tweak to 1 after a previous issue, but not on this computer. It's fine now. Now, to find a nice Extractor icon for the toolbar.

By the way back several months ago I suggested AVI come up with a better icon, but it didn't happen. Actually, I think he did, but it's not that great, especially with the white background. We may have to send him one or modify it. :)
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

highend
Posts: 13033
Joined: 06 Feb 2011 00:33

Re: Extractor - Extract, cleanup and delete archives

Post by highend »

In reviewing your last post there, I see you mentioned that the duplicate adjacent clips does not work and you're right even with 7.7b1.
The variable LASTCLIP is always empty, that's the reason why it doesn't work correctly. Didn't had the time to find out why that's the case.
Now, to find a nice Extractor icon for the toolbar.
I've attached one, that I just created...
or modify it.
That's one of the first things I did :) Good that it's written in AHK and we can compile it ourselfs!
Unpack_Archive.zip
(1.53 KiB) Downloaded 252 times
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

klownboy
Posts: 4052
Joined: 28 Feb 2012 19:27

Re: Extractor - Extract, cleanup and delete archives

Post by klownboy »

highend wrote:That's one of the first things I did Good that it's written in AHK and we can compile it ourselfs!
I was compiling my own version for a number of his releases, but they were coming so frequently that I stopped. In that thread, I had asked AVI what compression tool he used, since his final result was always smaller than what I was achieving using the AHK2Exe's "mpress". He uses (at least he did then) "upx" freeware available here: http://upx.sourceforge.net/. Uncheck using "mpress" during compilation and instead use "upx" with the --best option. Maybe once the revision frequency settles down I'll do it again. Even a picture of a "scissors" like the snipping tool in Windows 7 wouldn't be a bad tray icon.
highend wrote:The variable LASTCLIP is always empty, that's the reason why it doesn't work correctly. Didn't had the time to find out why that's the case.
Maybe you should pass that on (i.e., edit your post) incase he doesn't realize it. It may save him some grief trying to figure it out.

Thanks for the icon!
Ken
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

highend
Posts: 13033
Joined: 06 Feb 2011 00:33

Re: Extractor - Extract, cleanup and delete archives

Post by highend »

Ok, the old version (with CheckProcess.exe) is gone...

It makes no sense to do it with normal XY scripting.
The new version is a compiled .ahk script and you only need a twoliner to invoke it from XYplorer.

Advantages:
You can do whatever you like with / within XYplorer while Extractor.exe is running
- Switch / Close tabs
- Minimize it
- Close it^^

Extractor takes care which instance of XYplorer called it and will only interact with this instance when it comes to:
- deleting files (to retain XYplorer's undo feature)
- selecting folders (after extracting)

If the calling instance of XYplorer was closed during Extractor's work or a different application is active when Extractor finishes it won't try to interact with XY but silently send files to the recycle bin (if DeleteArchives=1).
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

klownboy
Posts: 4052
Joined: 28 Feb 2012 19:27

Re: Extractor - Extract, cleanup and delete archives

Post by klownboy »

Hi highend,
I tried the new script. I'm finding it works great unless you select a single archive (in this case - AutoHotkey.zip) in which the beginning of the name is the same as a bunch of other archives. Capture 01 below is the file listing in XYplorer showing only AutoHotkey.zip selected.
Extractor_Capture_01.JPG
Extractor_Capture_01.JPG (27.7 KiB) Viewed 5490 times
The delete confirmation box when "DeleteArchives=1" will come up with all the other archives that have the same start to the name. See capture 02.
Extractor_Capture_02.JPG
Extractor_Capture_02.JPG (51.93 KiB) Viewed 5490 times
The proper archive does get extracted, in this case AutoHotkey.zip. It appears that the ";Delete archive file(s)" section of the ahk code is picking up all files that start with AutoHotkey. I see where you get those file names into AHK in the beginning of the AHK script through XY's "selectedItemsPathNames"? Couldn't you use exactly the same file name(s) again for the deletion process when "DeleteArchives=1". (I got lost in the code :) ) ? In exactly the same scenario with "DeleteArchives=0", as you would expect the delete confirmation box does not come up and again the archive is properly extracted. For your info, I'm using the compiled exe you provided with a CTB setup as you described.
Thanks,
Ken
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

highend
Posts: 13033
Joined: 06 Feb 2011 00:33

Re: Extractor - Extract, cleanup and delete archives

Post by highend »

Hi Ken,

I've tweaked the "Delete archive file(s) part a bit.
It should work better with single / multipart archives now.

Replace the full section with

Code: Select all

; Delete archive file(s)
if (ini_DeleteArchives = 1) {
	if (multipleArchives = 1) {
		; Loop over all supplied files
		Loop, %xyCountSelectedFiles%
		{
			fileName := a_XYSelectedFiles%A_Index%
			l_filesToSelect .= (A_Index = 1) ? fileName : "`n" fileName
		}
	} else {
		; Try to select all files that belong to an archive
		; New rar archive format: <name>.part<number>.rar (all)
		; Old rar archive format: <name>.rar | <name>.r<number> (following)
		; New zip archive format: <name>.zipx | <name>.zx<number> (following)
		; Old zip archive format: <name>.zip | <name>.z<number> (following)
		; 7-Zip archive format: <name>.7z.<number> (all)
		rarNewFilterPattern := RegExReplace(xyFirstFileBaseName, "(.*?\.part)\d+", "$1")
		rarOldFilterPattern := RegExReplace(xyFirstFileName, "(.*?[^0-9]\.r)ar", "$1")
		zipNewFilterPattern := RegExReplace(xyFirstFileName, "(.*?\.z)(ip)(x)?", "$1$3")
		zipOldFilterPattern := RegExReplace(xyFirstFileName, "(.*?\.z)ip$", "$1")
		sevenZipFilterPattern := RegExReplace(xyFirstFileName, "(.*?\.7z\.)\d+", "$1")

		if (rarNewFilterPattern != xyFirstFileBaseName)
			filterPattern := rarNewFilterPattern
		else if (rarOldFilterPattern != xyFirstFileName)
			filterPattern := rarOldFilterPattern
		else if (zipNewFilterPattern != xyFirstFileName)
			filterPattern := zipNewFilterPattern
		else if (zipOldFilterPattern != xyFirstFileName)
			filterPattern := zipOldFilterPattern
		else if (sevenZipFilterPattern != xyFirstFileName)
			filterPattern := sevenZipFilterPattern

		; Build initial list
		Loop, %xyCurrentPath%\%filterPattern%*, 0
			l_filesToSelect .= (A_Index = 1) ? A_LoopFileLongPath : "`n" A_LoopFileLongPath

		; Exceptions for old zip multipart archives
		if (xyFirstFileExt = "zip") {
			Loop, parse, l_filesToSelect, `n
			{
				SplitPath, A_LoopField, , , selExt
				if selExt contains zipx,zx
					continue
				l_tempFilesToSelect .= (A_Index = 1) ? A_LoopField : "`n" A_LoopField
			}
			l_filesToSelect := l_tempFilesToSelect
		}

		if (xyFirstFileExt = "zipx")
			l_filesToSelect := xyCurrentPath "\" xyFirstFileName "`n" l_filesToSelect
	}
}
else
	ExitApp
compile it and give it a go :)
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

klownboy
Posts: 4052
Joined: 28 Feb 2012 19:27

Re: Extractor - Extract, cleanup and delete archives

Post by klownboy »

I incorporated your change, recompiled the ahk file and then ran it on a numerous archives with similar names like the example above and guess what, I haven't come across any issues! Thanks highend.
Ken
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

highend
Posts: 13033
Joined: 06 Feb 2011 00:33

Re: Extractor - Extract, cleanup and delete archives

Post by highend »

I haven't come across any issues
I found a small issue while testing the different supported applications on a few archive files (to tweak each one's Extensions line in the .ini file).

v0.9.2 (download from first post)

Code: Select all

Fixed:
If a .zipx (new zip format) file is detected but it's not a multipart archive, an empty (checked) line was added to the file delete dialog.

Changed:
Extractor.ini file
Added a line for not supported archives
Tweaked the Extensions= types
I've added instructions how to navigate the file delete window (keyboard shortcuts, context menu, etc) in the first post as well.
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

klownboy
Posts: 4052
Joined: 28 Feb 2012 19:27

Re: Extractor - Extract, cleanup and delete archives

Post by klownboy »

Hi highend,
No issues noted with version 0.9.2. I ran it on about 10 differnet archives until I figured I was wearing out my SSD. :) I don't believe I've run across any "zipx" files yet. I typically don't run across many multi-part rar and zips unless I'm in newgroups (e.g., Giganews) and downloading from there. Though in those cases, the multi-part archive has "par" files to repair and file the holes and missing pieces. So I'm always using quickpar or smartpar to combine / repair / extract the archive. I can see why it wasn't so easy as simply using the "selectedItemsPathNames" for the deletion of the archives. By the way, the old "WinRAR" box was back again until I put the "-ibck" in the parameters.
Thanks, very nice script. :appl:
Ken
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

highend
Posts: 13033
Joined: 06 Feb 2011 00:33

Re: Extractor - Extract, cleanup and delete archives

Post by highend »

So I'm always using quickpar or smartpar to combine / repair / extract the archive
SABnzbd does all these things without any user intervention, no need (for me) to use quickbar.
I can see why it wasn't so easy as simply using the "selectedItemsPathNames" for the deletion of the archives.
It's easy if the user selected multiple files but for multipart archives (where only the first file should be selected) it get's a little more complicated to find the belonging files.
very nice script
Thanks.
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

klownboy
Posts: 4052
Joined: 28 Feb 2012 19:27

Re: Extractor - Extract, cleanup and delete archives

Post by klownboy »

Thanks highend, I've been using an old version of Forte's Agent which was good at one time, but I think it's getting dated. I downloaded and installed SABnzbd and will check it out further. I typically don't like web based programs for security reasons. Any concerns there? It is nice that it's open source/free.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

highend
Posts: 13033
Joined: 06 Feb 2011 00:33

Re: Extractor - Extract, cleanup and delete archives

Post by highend »

Any concerns there?
Nope. It exists for several years and I never saw anything concerning security in their forums / anywhere else. One of the best apps especially since the development of Newsleecher stalled ;)
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

highend
Posts: 13033
Joined: 06 Feb 2011 00:33

Re: Extractor - Extract, cleanup and delete archives

Post by highend »

Added v0.9.3 release to the first posting...
@Changelog:
v0.9.3:
* Fixed old rar multipart detection (support for all file names, new rar multipart archives are excluded)
* Fallback for different archive types
The fallback was needed, otherwise too many files could have been selected.
Last edited by highend on 17 Sep 2013 10:44, edited 1 time in total.
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

klownboy
Posts: 4052
Joined: 28 Feb 2012 19:27

Re: Extractor - Extract, cleanup and delete archives

Post by klownboy »

Hi highend, v0.9.3 is working great. You couldn't make it any easier than that to unarchive. :appl:
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

highend
Posts: 13033
Joined: 06 Feb 2011 00:33

Re: Extractor - Extract, cleanup and delete archives

Post by highend »

Thanks Ken.

After using it for about a week everything seems nice & stable now :)

Do you think an automatic resize function for the delete window would be an inprovement?

It should calculate (respecting some min + max values) the width and height of that window by looking how many file entries we have and what's the longest filename (including path).

The current static one is always a bit large when you only have a single file that's listed in there...
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

Post Reply