| View previous topic :: View next topic |
| Author |
Message |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Wed Jun 06, 2007 2:53 am Post subject: Zip/Unzip using native ZipFolder Feature in XP |
|
|
It provides a basic zip/unzip support in XP using the native ZipFolder support.
Naturally, the ZipFolder should be enabled for the script to work (regsvr32.exe /s zipfldr.dll).
The example in the script does:
zipping this script/CoHelper.ahk/FileHelper.ahk to script.zip in the temporary folder, then unzipping it in the temporary folder.
DOWNLOAD ZipFolder.ahk and CoHelper.ahk and FileHelper.ahk. |
|
| Back to top |
|
 |
shajul
Joined: 15 Sep 2006 Posts: 564
|
Posted: Sat May 17, 2008 1:34 pm Post subject: great! |
|
|
great work..
exactly what i was looking for..
but unzip does not seem to work! am i missing something? _________________ If i've seen further it is by standing on the shoulders of giants
my site | ~shajul | WYSIWYG BBCode Editor |
|
| Back to top |
|
 |
freakkk
Joined: 29 Jul 2005 Posts: 179
|
Posted: Sat May 17, 2008 2:29 pm Post subject: Re: great! |
|
|
| shajul wrote: | | am i missing something? | Yes.
Works fine here. What code are you using? _________________ .o0[ corey ]0o. |
|
| Back to top |
|
 |
shajul
Joined: 15 Sep 2006 Posts: 564
|
Posted: Sat May 17, 2008 4:40 pm Post subject: Thanks!! |
|
|
Thanks for your prompt reply!
Works fine now! some bug in my system maybe
thanks again! _________________ If i've seen further it is by standing on the shoulders of giants
my site | ~shajul | WYSIWYG BBCode Editor |
|
| Back to top |
|
 |
n-l-i-d Guest
|
Posted: Sat May 17, 2008 5:57 pm Post subject: |
|
|
Wow!
but, how the ... did I miss this excellent script?
|
|
| Back to top |
|
 |
Drugwash Guest
|
Posted: Mon Aug 11, 2008 10:12 pm Post subject: Unzip in other Windows versions...? |
|
|
Hello!
Apologies for barging in. I'm trying to find a simple, preferrably open-source solution to unpack a zip from within an ahk script - eventually a compiled script, more of an installer, that could be freely distributed.
Problem is, I need this to work in all Windows versions from Win95 to Vista, so relying on XP's built-in code is not an option. Could anyone kindly offer some tips in this regard? Thank you! |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 3700 Location: Louisville KY USA
|
Posted: Tue Aug 12, 2008 12:11 am Post subject: |
|
|
perfect _________________
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed; |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 4652 Location: AHK Forum
|
|
| Back to top |
|
 |
stevenA Guest
|
Posted: Wed Dec 10, 2008 6:49 pm Post subject: |
|
|
Hi, is there anyway possible to have Password protection for the zip, for this process?  |
|
| Back to top |
|
 |
..:: Free Radical ::..
Joined: 20 Sep 2006 Posts: 72
|
Posted: Wed Feb 03, 2010 5:49 pm Post subject: |
|
|
Noticed since most of us have moved to COM stdlib, it may help someone looking for an updated version
| Code: |
Zip(sDir, sZip)
{
If Not FileExist(sZip)
{
VarSetCapacity(Header, 22, 0)
Header := "PK" . Chr(5) . Chr(6)
ReadMemory(sZip, &Header, 22)
}
psh := COM_ActiveXObject("Shell.Application")
pzip := COM_Invoke(psh, "Namespace", sZip)
COM_Invoke(pzip, "CopyHere", sDir, 4|16)
Sleep, 1000
COM_Release(pzip)
COM_Release(psh)
}
Unz(sZip, sUnz)
{
psh := COM_ActiveXObject("Shell.Application")
pzip := COM_Invoke(psh, "Namespace", sZip)
punz := COM_Invoke(psh, "Namespace", sUnz)
pitms:= COM_Invoke(pzip, "Items")
COM_Invoke(punz, "CopyHere", "+" . pitms, 4|16)
Sleep, 1000
COM_Release(pitms)
COM_Release(pzip)
COM_Release(punz)
COM_Release(psh)
}
|
|
|
| Back to top |
|
 |
aparden
Joined: 12 Dec 2009 Posts: 15
|
Posted: Thu Feb 04, 2010 2:37 am Post subject: |
|
|
| n-l-i-d wrote: | Wow!
but, how the ... did I miss this excellent script?
|
Likewise!
Thx sean and free radical |
|
| Back to top |
|
 |
Dreck Guest
|
Posted: Thu Feb 04, 2010 2:10 pm Post subject: |
|
|
Mhh, your version, sadly, doesn't work, Free Radical.
| Quote: | Function Name: "Namespace"
Error: The COM Object may not be a valid one! |
Get the same error with "CopyHere".[/quote] |
|
| Back to top |
|
 |
WankaUSR
Joined: 14 Aug 2007 Posts: 86
|
Posted: Fri Feb 05, 2010 12:07 pm Post subject: |
|
|
| I had the same problem and the reason was that path you want to extract in must exist, zip file must exist and be careful how you parse variable to the function. if you are having problems please post your script |
|
| Back to top |
|
 |
..:: Free Radical ::..
Joined: 20 Sep 2006 Posts: 72
|
Posted: Fri Feb 05, 2010 1:25 pm Post subject: |
|
|
| Dreck wrote: | Mhh, your version, sadly, doesn't work, Free Radical.
| Quote: | Function Name: "Namespace"
Error: The COM Object may not be a valid one! |
Get the same error with "CopyHere". |
works for me
Still needs FileHelper.ahk.
Don't forget to #include it.
Also, the sDir must exist, so just use FileSelectFolder to create the folder to zip to, before calling the function,
or add it to the function. |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 5043 Location: the tunnel(?=light)
|
Posted: Fri Feb 26, 2010 6:30 pm Post subject: |
|
|
Full credit for re-writing these functions for AutoHotkey_L and COM_L goes to answer4u, I removed the Sleep commands as I believe they were related to the timing of the manual release of COM objects in the original, which is no longer necessary in COM_L:
| Code: | Zip(sDir, sZip)
{
If Not FileExist(sZip)
{
VarSetCapacity(Header, 22, 0)
Header := "PK" . Chr(5) . Chr(6)
ReadMemory(sZip, &Header, 22)
}
COM_CreateObject( "Shell.Application" ).Namespace( sZip ).CopyHere( sDir, 4|16 )
}
Unz(sZip, sUnz)
{
psh := COM_CreateObject("Shell.Application")
psh.Namespace( sUnz ).CopyHere( psh.Namespace( sZip ).items, 4|16 )
} |
_________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|
| Back to top |
|
 |
|