AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Zip/Unzip using native ZipFolder Feature in XP
Goto page 1, 2, 3  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Wed Jun 06, 2007 2:53 am    Post subject: Zip/Unzip using native ZipFolder Feature in XP Reply with quote

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
View user's profile Send private message
shajul



Joined: 15 Sep 2006
Posts: 564

PostPosted: Sat May 17, 2008 1:34 pm    Post subject: great! Reply with quote

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
View user's profile Send private message Visit poster's website Yahoo Messenger
freakkk



Joined: 29 Jul 2005
Posts: 179

PostPosted: Sat May 17, 2008 2:29 pm    Post subject: Re: great! Reply with quote

shajul wrote:
am i missing something?
Yes. Very Happy
Works fine here. What code are you using?
_________________
.o0[ corey ]0o.
Back to top
View user's profile Send private message
shajul



Joined: 15 Sep 2006
Posts: 564

PostPosted: Sat May 17, 2008 4:40 pm    Post subject: Thanks!! Reply with quote

Thanks for your prompt reply!

Works fine now! some bug in my system maybe Sad

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
View user's profile Send private message Visit poster's website Yahoo Messenger
n-l-i-d
Guest





PostPosted: Sat May 17, 2008 5:57 pm    Post subject: Reply with quote

Wow!

Very Happy Cool

but, how the ... did I miss this excellent script? Shocked

Quote:
Wed Jun 06, 2007
Back to top
Drugwash
Guest





PostPosted: Mon Aug 11, 2008 10:12 pm    Post subject: Unzip in other Windows versions...? Reply with quote

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

PostPosted: Tue Aug 12, 2008 12:11 am    Post subject: Reply with quote

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
View user's profile Send private message
HotKeyIt



Joined: 18 Jun 2008
Posts: 4652
Location: AHK Forum

PostPosted: Wed Aug 13, 2008 11:23 pm    Post subject: Reply with quote

Very useful, many thanks.
_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun Wink
Back to top
View user's profile Send private message
stevenA
Guest





PostPosted: Wed Dec 10, 2008 6:49 pm    Post subject: Reply with quote

Hi, is there anyway possible to have Password protection for the zip, for this process? Smile
Back to top
..:: Free Radical ::..



Joined: 20 Sep 2006
Posts: 72

PostPosted: Wed Feb 03, 2010 5:49 pm    Post subject: Reply with quote

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
View user's profile Send private message
aparden



Joined: 12 Dec 2009
Posts: 15

PostPosted: Thu Feb 04, 2010 2:37 am    Post subject: Reply with quote

n-l-i-d wrote:
Wow!

Very Happy Cool

but, how the ... did I miss this excellent script? Shocked

Quote:
Wed Jun 06, 2007


Likewise!

Thx sean and free radical
Back to top
View user's profile Send private message
Dreck
Guest





PostPosted: Thu Feb 04, 2010 2:10 pm    Post subject: Reply with quote

Mhh, your version, sadly, doesn't work, Free Radical. Sad

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

PostPosted: Fri Feb 05, 2010 12:07 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
..:: Free Radical ::..



Joined: 20 Sep 2006
Posts: 72

PostPosted: Fri Feb 05, 2010 1:25 pm    Post subject: Reply with quote

Dreck wrote:
Mhh, your version, sadly, doesn't work, Free Radical. Sad

Quote:
Function Name: "Namespace"
Error: The COM Object may not be a valid one!


Get the same error with "CopyHere".


works for me Crying or Very sad

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
View user's profile Send private message
sinkfaze



Joined: 18 Mar 2008
Posts: 5043
Location: the tunnel(?=light)

PostPosted: Fri Feb 26, 2010 6:30 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group