Re: Zip a file programatically
From: SumYungGuy (jay.winks_at_teksouth.com)
Date: 10/11/04
- Next message: Fernando Vaca: "Please help..."
- Previous message: Brian: "Re: making a list of printer to choose from"
- In reply to: Miyahn: "Re: Zip a file programatically"
- Next in thread: Alaric: "Re: Zip a file programatically"
- Reply: Alaric: "Re: Zip a file programatically"
- Messages sorted by: [ date ] [ thread ]
Date: 11 Oct 2004 16:49:29 -0700
OK, Miyahn, your "unreliable" script works on WinXP SP2 if any
third-party zip utils are not installed. But I am having difficulty
making it work in Server 2003. I appreciate your help. But I am
beginning to lean like the others have posted about using 3rd party.
Or tackling my problem a different way.
Thanks
"Miyahn" <HQF03250@nifty.ne.jp> wrote in message news:<eG6#GAirEHA.2924@TK2MSFTNGP12.phx.gbl>...
> "Red" wrote in message news:5eb6d95.0410080220.213176e0@posting.google.com
> > Help why doesn't this zip work it creates the .ZIP file but does not
> > copy the source to it?!??! No errors, I can drag files into the .zip
> > created with the script what gives?
> > Also tried different source and locations -thanks.
>
> Try this "unreliable" script at your own risk.
>
> Const ssfSendTo = 9, MySource = "C:\tmp", MyZipName = "C:\temp\SinkFolder.zip"
> Dim WS, FS, SA, ZipFile
> Set WS = CreateObject("WScript.Shell")
> Set FS = CreateObject("Scripting.FileSystemObject")
> Set SA = CreateObject("Shell.Application")
> FS.CreateTextFile(MyZipName, True).Write _
> Chr(80) & Chr(75) & Chr(5) & Chr(6) & String(18, Chr(0))
> SA.Open SA.NameSpace(MyZipName)
> WScript.Sleep 100
> WS.SendKeys "%{F4}", True
> FS.DeleteFile MyZipName
> SelectItem MySource, ""
> WS.SendKeys "^(ac)", True
> WS.SendKeys "%{F4}", True
> SelectItem ssfSendTo, "Compressed (zipped) Folder.ZFSendToTarget"
> WS.SendKeys "+{F10}P", True
> WS.SendKeys "%{F4}", True
> ZipFile = FS.BuildPath(MySource, ZipFile)
> Do Until FS.FileExists(ZipFile): WScript.Sleep 100: Loop
> On Error Resume Next
> Do
> FS.GetFile(ZipFile).Move MyZipName
> WScript.Sleep 100
> Loop While Err
> On Error GoTo 0
> Set SA = Nothing: Set FS = Nothing: Set WS = Nothing
> '
> Sub SelectItem(Parent, Target)
> SA.Open SA.NameSpace(Parent)
> WScript.Sleep 100
> For Each aWin In SA.Windows
> If aWin.Document.Folder.Items.Item.Path = SA.NameSpace(Parent).Items.Item.Path Then
> If Target <> "" Then
> aWin.Document.SelectItem SA.NameSpace(Parent).ParseName(Target), 1
> Else
> ZipFile = FS.GetBaseName(aWin.Document.FocusedItem.Name) & ".zip"
> End If
> End If
> Next
> End Sub
- Next message: Fernando Vaca: "Please help..."
- Previous message: Brian: "Re: making a list of printer to choose from"
- In reply to: Miyahn: "Re: Zip a file programatically"
- Next in thread: Alaric: "Re: Zip a file programatically"
- Reply: Alaric: "Re: Zip a file programatically"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|