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

Post your working scripts, libraries and tools
Peter2
Posts: 252
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 7 x64, AHK Version v1.1.22.xx
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: 7695
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
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, 2x8GB G.Skill RipJaws V - DDR4 3280 MHz | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
list
Posts: 192
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: 7695
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
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, 2x8GB G.Skill RipJaws V - DDR4 3280 MHz | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
list
Posts: 192
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: 7695
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
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, 2x8GB G.Skill RipJaws V - DDR4 3280 MHz | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]

Return to “Scripts and Functions”

Who is online

Users browsing this forum: Bing [Bot], Orbort and 20 guests