Page 2 of 2

Re: ZipFile [AHK v1.1 and AHK v2.0]

Posted: 13 Jan 2017, 12:19
by Peter2
7za - wrapper discussion is continued here:
https://autohotkey.com/boards/viewtopic.php?f=5&t=26832

Re: ZipFile [AHK v1.1 and AHK v2.0]

Posted: 14 Apr 2017, 10:18
by p0p0v
Coco wrote:

Code: Select all

	MsgBox % "Name: "            . item.name
	       . "`nSize: "          . item.size
	       . "`nType: "          . item.type
	       . "`nDate modified: " . item.date
	       . "`nRelative Path: " . item.path
this does not work - all values are blank :(

Re: ZipFile [AHK v1.1 and AHK v2.0]

Posted: 20 May 2018, 11:09
by Dravenizer
Is it possible to create a folder inside the zip and then add files inside that folder?

Re: ZipFile [AHK v1.1 and AHK v2.0]

Posted: 20 May 2018, 16:01
by Guest
Probably the easiest solution would be to create a folder, copy/move the files there, zip the folder and delete the files (zipfile can do that for you)

Code: Select all

TestZip := new ZipFile("TestZip.zip")
TestZip.pack("folder",1) ; 1 = del

Re: ZipFile [AHK v1.1 and AHK v2.0]

Posted: 12 Jun 2018, 14:03
by joedf
Started using this in one of my recent projects, works flawlessly!

But Maybe I suggest maybe add the option to hide/show the native progress dialog? 256|16 Otherwise, applications using this when extracting large Zip files seem frozen until the extraction is complete.
https://github.com/cocobelgica/AutoHotk ... e.ahk#L108

make 4|16 the default but allow advanced users to change it to whatever listed in here as an extra parameter? :
https://autohotkey.com/board/topic/6070 ... ta7-ahk-l/
4 Do not display a progress dialog box.
8 Give the file being operated on a new name in a move, copy, or rename operation if a file with the target name already exists.
16 Respond with "Yes to All" for any dialog box that is displayed.
64 Preserve undo information, if possible.
128 Perform the operation on files only if a wildcard file name (*.*) is specified.
256 Display a progress dialog box but do not show the file names.
512 Do not confirm the creation of a new directory if the operation requires one to be created.
1024 Do not display a user interface if an error occurs.
2048 Version 4.71. Do not copy the security attributes of the file.
4096 Only operate in the local directory. Don't operate recursively into subdirectories.
9182 Version 5.0. Do not move connected files as a group. Only move the specified files.

Re: ZipFile [AHK v1.1 and AHK v2.0]

Posted: 21 Feb 2020, 13:10
by list
I'm running into problems with paths or file names that contain unicode characters, it seems Windows can't handle it as the following warning pops up and the script stalls after that:
[Window Title]
Compressed (zipped) Folders Error

[Content]
'D:\test\Google 雲端硬碟' cannot be compressed because it includes characters that cannot be used in a compressed folder, such as 雲端硬碟. You should rename this file or directory.
Anybody know if it is at all possible to Zip file names that contain unicode characters using the Windows native Zip feature that this (and other similar functions posted on the forum) uses? I know I could resort to third party zip programs (exe, dll) but would like to avoid it.

Re: ZipFile [AHK v1.1 and AHK v2.0]

Posted: 21 Feb 2020, 13:29
by joedf
What if you renamed your files temporarily and renamed back after compressing them? :think:

Re: ZipFile [AHK v1.1 and AHK v2.0]

Posted: 21 Feb 2020, 13:43
by list
On my own system I probably would do that, but I wouldn't like to be responsible for other peoples files :)

I'm guessing it wouldn't be allowed in this particular case as either it is a Google Drive folder and they are probably protected one way or another (haven't tested as I'm not going to install Google Drive)

I did find https://www.example-code.com/vbscript/zip_utf8.asp with this line:

Code: Select all

' To zip using utf-8 filenames, set the OemCodePage = 65001
zip.OemCodePage = 65001

Re: ZipFile [AHK v1.1 and AHK v2.0]

Posted: 21 Feb 2020, 15:50
by joedf
Oh wow, nice find!!!! :+1:

Re: ZipFile [AHK v1.1 and AHK v2.0]

Posted: 09 Jul 2021, 15:03
by elmo
joedf wrote:
12 Jun 2018, 14:03
Started using this in one of my recent projects, works flawlessly!
Hello joedf,

This looks quite promising and it appears you may have the most recent experience.

Some questions Sir if you have a moment.

First, I liked your idea of 256|16 versus to 4|16; or optionally some others to make it quieter. Is that possible ?

Second, there is much activity in the class around "TempFolder". In my case I would always be writing to a brand new zip archive and so the archive itself would most assuredly not be in the source path. Is there any way to deprecate the creation of this temp and the associated movement ?

Third, empty directories at the source induce a prompt. Is there a way to be rid of that also ?

Thank you in advance for your time and attention. I certainly understand if you are no longer working with this.

Re: ZipFile [AHK v1.1 and AHK v2.0]

Posted: 09 Jul 2021, 15:18
by joedf
1) I changed this

Code: Select all

dest[IsPack && arg ? "MoveHere" : "CopyHere"](items, 4|16)
to

Code: Select all

dest[IsPack && arg ? "MoveHere" : "CopyHere"](items, 16|256)
2) I've not looked at it too much in depth, but unless this is absolutely necessary... I would leave it as it is. :think:

3) I think maybe you could try 16|256|512 ?

Re: ZipFile [AHK v1.1 and AHK v2.0]

Posted: 09 Jul 2021, 17:07
by elmo
@joedf

Thank you for the timely response. No luck ignoring the empty folder, however it was also hidden so removing |0x00080 from the filter worked:

Code: Select all

items.Filter(0x00020|0x00040, fspec)
Can I ask if this is still your go to zip solution, or have you found an alternative ?

Re: ZipFile [AHK v1.1 and AHK v2.0]

Posted: 09 Jul 2021, 19:59
by joedf
Nice, thanks for sharing! :+1:
Yes, this is still what I use. Otherwise, I use 7za.