I hope I am posting this to the correct group. If not, please let me know.

I inherited a VBS program that executes WinZip to compress files. Based on
what has been done in the past, this was run manually each time by simply
clicking on the file. I have run it successfully many times since I took
over the task.

I am attempting to automate this by adding this to Scheduled Tasks. Now,
the program fails. As near as I can tell, the failure occurs at the point
that the WinZip command is to be executed. The line I believe is failing is:

WshShell.Run ZipCommand, 1, True

The ZipCommand contains the actual WinZip command to be executed such as:

c:\winzip100\wzzip "d:\tstar\ADM CY2006.zip" @"d:\tstar\ZIPLIST_ADM.txt"


I have two questions:
1) Can someone offer some insight as to why this would fail when executed
from Scheduled Tasks, but work fine manually? Or is there a better approach
to get this done?

2) I have been searching for information on the last two parameters of the
Run command ("1" and "True") but cannot find anything. Can someone tell me
what they are used for and the valid entries for each?

I have limited experience with scripts so please be patient.

Thanks.

Re: Script to Zip Files by Ayush

Ayush
Wed May 16 12:39:42 CDT 2007

[Martin]s message :
> I have two questions:
> 1) ... Or is there a better approach
> to get this done?
Try:
http://groups.google.com/group/microsoft.public.scripting.vbscript/browse_thread/thread/e3abc58943aa16f1/cb811bfe96217084

> 2) I have been searching for information on the last two parameters of the
> Run command ("1" and "True") but cannot find anything. Can someone tell me
> what they are used for and the valid entries for each?

Get Script56: http://snipurl.com/WSH_Documentation

2nd param:intWindowStyle
Optional. Integer value indicating the appearance of the program's window. Note that
not all programs make use of this information.

3rd param:bWaitOnReturn
Optional. Boolean value indicating whether the script should wait for the program to
finish executing before continuing to the next statement in your script. If set to
true, script execution halts until the program finishes, and Run returns any error
code returned by the program. If set to false (the default), the Run method returns
immediately after starting the program, automatically returning 0 (not to be
interpreted as an error code).


Good Luck, Ayush.
--
Scripting Solutions Center : http://snipurl.com/Scripting_Solutions

Re: Script to Zip Files by Martin

Martin
Wed May 16 13:16:01 CDT 2007

Thanks for the reply.

I guess I should have stated my first question in a better way: Is there a
better approach still using WinZip? Considering my lack of programming
experience, I do not want to go deeper than I need to.

Is there something in that line that would prevent it from executing using
Scheduled Tasks?

I had already downloaded the documentation you referred to. It does nothing
but display "Page cannot be displayed". But thanks for the descriptions.



"Ayush" <"ayushmaan.j[aatt]gmail.com" wrote:

> [Martin]s message :
> > I have two questions:
> > 1) ... Or is there a better approach
> > to get this done?
> Try:
> http://groups.google.com/group/microsoft.public.scripting.vbscript/browse_thread/thread/e3abc58943aa16f1/cb811bfe96217084
>
> > 2) I have been searching for information on the last two parameters of the
> > Run command ("1" and "True") but cannot find anything. Can someone tell me
> > what they are used for and the valid entries for each?
>
> Get Script56: http://snipurl.com/WSH_Documentation
>
> 2nd param:intWindowStyle
> Optional. Integer value indicating the appearance of the program's window. Note that
> not all programs make use of this information.
>
> 3rd param:bWaitOnReturn
> Optional. Boolean value indicating whether the script should wait for the program to
> finish executing before continuing to the next statement in your script. If set to
> true, script execution halts until the program finishes, and Run returns any error
> code returned by the program. If set to false (the default), the Run method returns
> immediately after starting the program, automatically returning 0 (not to be
> interpreted as an error code).
>
>
> Good Luck, Ayush.
> --
> Scripting Solutions Center : http://snipurl.com/Scripting_Solutions
>