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

Post your working scripts, libraries and tools for AHK v1.1 and older
Peter2
Posts: 325
Joined: 21 Sep 2014, 14:38
Location: CH

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

13 Jan 2017, 12:19

7za - wrapper discussion is continued here:
https://autohotkey.com/boards/viewtopic.php?f=5&t=26832
Peter (AHK Beginner) / Win 10 x64, AHK Version v1.1.33
p0p0v
Posts: 4
Joined: 13 Apr 2017, 14:45

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

14 Apr 2017, 10:18

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 :(
Dravenizer
Posts: 3
Joined: 08 Apr 2017, 19:03

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

20 May 2018, 11:09

Is it possible to create a folder inside the zip and then add files inside that folder?
Guest

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

20 May 2018, 16:01

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
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

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

12 Jun 2018, 14:03

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.
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
list
Posts: 221
Joined: 26 Mar 2014, 14:03
Contact:

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

21 Feb 2020, 13:10

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.
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

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

21 Feb 2020, 13:29

What if you renamed your files temporarily and renamed back after compressing them? :think:
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
list
Posts: 221
Joined: 26 Mar 2014, 14:03
Contact:

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

21 Feb 2020, 13:43

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
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

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

21 Feb 2020, 15:50

Oh wow, nice find!!!! :+1:
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
elmo
Posts: 113
Joined: 09 Oct 2013, 09:08

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

09 Jul 2021, 15:03

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.
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

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

09 Jul 2021, 15:18

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 ?
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
elmo
Posts: 113
Joined: 09 Oct 2013, 09:08

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

09 Jul 2021, 17:07

@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 ?
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

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

09 Jul 2021, 19:59

Nice, thanks for sharing! :+1:
Yes, this is still what I use. Otherwise, I use 7za.
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: chinagreenelvis and 86 guests