Is there a simple method of calling winzip etc. from vbscript or should i
use a simple batch file instead? The "problem" is that customer would like
to have a vbscript for some reason to do this operation, which is a simple
zipping of logfiles which would be automatically sent via email to customer,
and as I see it, a batch file would do the trick as well.

This might seem a stupid question, but I'd just like to have an opinion. Or
if someone can point me to a example script somewhere, I might as well do it
and get away with it :)

RE: Zip + email: vbscript or simple batch? by anonymous

anonymous
Fri Apr 30 06:46:01 CDT 2004


Go to http://winzip.com/downcl.htm and check that out.

Then you can use this code that does exactly what you want to.
<--CODE BEGINS--
Set Shell = CreateObject("WScript.Shell"
set FS = CreateObject("Scripting.FileSystemObject"

FS.CreateTextFile("zip.cmd"
Set filezip = FS.OpenTextfile("zip.cmd", ForAppending
filezip.WriteLine "f:
filezip.WriteLine "cd some folder
filezip.WriteLine "cd some subfolder
filezip.WriteLine "Del OldZipFile.zip
filezip.WriteLine "wzzip NewZipFileNameHere.zip FilesToADD.txt" <-- You can use wildcards her
filezip.Clos
'=============================================
Shell.Run "zip.cmd",2,Tru
Wscript.Echo "Done Zipping Up Files..."
& vbCRLF & "Starting To Email Out The Reports...
'=============================================
On Error Resume Nex
set FS = CreateObject("Scripting.FileSystemObject"
Set WSHShell = WScript.CreateObject("WScript.Shell"
Set objOutlook = Wscript.CreateObject("Outlook.Application"
strTitle="Send Outlook Email
'====Set a reference to the MailItem objec
Set objMsg = objOutlook.CreateItem(0
if err.number<>0 the
wscript.echo "("&err.number&") "& err.descriptio
wscript.echo "Error creating Outlook object.
wscript.quit(1
end i
'==== Recipient
strSendTo=objMsg.Recipients.Add ("someone@somewhere.com"
'strSendTo=objMsg.Recipients.Add ("someone@somewhere.com") 'Uncomment this out if you want to send to multiple peopl
'===== Add subjec
objMsg.Subject = "Reports for " & Dat
'===== Attach file
objMsg.Attachments.Add("FullPath&FileNameHere"
'objMsg.Attachments.Add("FullPath&FileNameHere") 'Uncomment this out if you want to attach mutiple file
'====Sends emai
objMsg.Sen
'===Clean U
Set objOutlook = Nothin
Set objMsg = Nothin
<--CODE ENDS-->

Re: Zip + email: vbscript or simple batch? by tomthumbkop

tomthumbkop
Fri Apr 30 09:39:45 CDT 2004


Any command that you would do in a batch can be replicated in VBscript
In the case of calling winzip from the command line, look at the Shel
object and the run method.

Nico Leiska wrote:
> *Is there a simple method of calling winzip etc. from vbscript o
> should i
> use a simple batch file instead? The "problem" is that customer woul
> like
> to have a vbscript for some reason to do this operation, which is
> simple
> zipping of logfiles which would be automatically sent via email t
> customer,
> and as I see it, a batch file would do the trick as well.
>
> This might seem a stupid question, but I'd just like to have a
> opinion. Or
> if someone can point me to a example script somewhere, I might a
> well do it
> and get away with it :)


-
tomthumbko
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
-----------------------------------------------------------------------


Re: Zip + email: vbscript or simple batch? by Craig

Craig
Mon May 03 12:10:22 CDT 2004

?

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...

Re: Zip + email: vbscript or simple batch? by Nico

Nico
Tue May 04 07:36:57 CDT 2004

Thanks a lot. I think this is it :)

o


"dk1983" <anonymous@discussions.microsoft.com> wrote in message
news:097596D3-3021-44E5-AFEA-A173B9B7BC63@microsoft.com...
>
> Go to http://winzip.com/downcl.htm and check that out..
>
> Then you can use this code that does exactly what you want to..
> <--CODE BEGINS-->
> Set Shell = CreateObject("WScript.Shell")
> set FS = CreateObject("Scripting.FileSystemObject")
>
> FS.CreateTextFile("zip.cmd")
> Set filezip = FS.OpenTextfile("zip.cmd", ForAppending)
> filezip.WriteLine "f:"
> filezip.WriteLine "cd some folder"
> filezip.WriteLine "cd some subfolder"
> filezip.WriteLine "Del OldZipFile.zip"
> filezip.WriteLine "wzzip NewZipFileNameHere.zip FilesToADD.txt" <-- You
can use wildcards here
> filezip.Close
> '==============================================
> Shell.Run "zip.cmd",2,True
> Wscript.Echo "Done Zipping Up Files..." _
> & vbCRLF & "Starting To Email Out The Reports..."
> '==============================================
> On Error Resume Next
> set FS = CreateObject("Scripting.FileSystemObject")
> Set WSHShell = WScript.CreateObject("WScript.Shell")
> Set objOutlook = Wscript.CreateObject("Outlook.Application")
> strTitle="Send Outlook Email"
> '====Set a reference to the MailItem object
> Set objMsg = objOutlook.CreateItem(0)
> if err.number<>0 then
> wscript.echo "("&err.number&") "& err.description
> wscript.echo "Error creating Outlook object."
> wscript.quit(1)
> end if
> '==== Recipients
> strSendTo=objMsg.Recipients.Add ("someone@somewhere.com")
> 'strSendTo=objMsg.Recipients.Add ("someone@somewhere.com") 'Uncomment this
out if you want to send to multiple people
> '===== Add subject
> objMsg.Subject = "Reports for " & Date
> '===== Attach files
> objMsg.Attachments.Add("FullPath&FileNameHere")
> 'objMsg.Attachments.Add("FullPath&FileNameHere") 'Uncomment this out if
you want to attach mutiple files
> '====Sends email
> objMsg.Send
> '===Clean UP
> Set objOutlook = Nothing
> Set objMsg = Nothing
> <--CODE ENDS-->