Page 1 of 1 1
Topic Options
#118463 - 2004-04-21 11:05 PM Shell command using a variable
MGilhouse Offline
Fresh Scripter

Registered: 2001-11-09
Posts: 5
Hello everyone:
I was hoping someone might help me with this one. I want to use the command line tool available with WinZip to automate some processes, but in order to get the desired effect I will need to have parts of the command in a variable:

Here's an example of my script:


; Below is what runs fine, I am making the passwords a variable in this example
; SHELL "C:\Program Files\WinZip\WZZIP.EXE -A -S(insert password) C:\MYZIP.ZIP C:\ZIPME.TXT"

If (@MONTHNO = "1")
$pswd = "YIKES"
EndIf

If (@MONTHNO = "2")
$pswd = "SPIKES"
EndIf

If (@MONTHNO = "3")
$pswd = "BIKES"
EndIf

If (@MONTHNO = "4")
$pswd = "NIKES"
EndIf

If (@MONTHNO = "5")
$pswd = "PIKES"
EndIf

If (@MONTHNO = "6")
$pswd = "MIKES"
EndIf

If (@MONTHNO = "7")
$pswd = "FIKES"
EndIf

If (@MONTHNO = "8")
$pswd = "SIKES"
EndIf

If (@MONTHNO = "9")
$pswd = "WIKES"
EndIf

If (@MONTHNO = "10")
$pswd = "ZIKES"
EndIf

If (@MONTHNO = "11")
$pswd = "LIKES"
EndIf

If (@MONTHNO = "12")
$pswd = "VIKES"
EndIf
' Sorry you get the point

$FirstPrt = Chr(34) + "C:\Program Files\WinZip\WZZIP.EXE -A -S"
$LastPrt = " C:\MYFILE.ZIP C:\ZIPME.TXT" + Chr(34)

$String = $FirstPrt + $pswd + $LastPrt

; Since it's April, $String returns "C:\Program Files\WinZip\WZZIP.EXE -A -SNIKES C:\MYFILE.ZIP C:\ZIPME.TXT"
; Here's the problem


SHELL $String




Unless I'm missing something, there is no error, no nothing, it just doesn't do it! The bad news for me is things are about to get trickier, I will have to have the source and resulting ZIP filenames as variables as WELL as the password part of the command.

Does anyone have any ideas? Before I posted I searched the BB for the keywords Shell and Variable and I read the UDF on WSHPIPE()
Thanks Guys!!

Top
#118464 - 2004-04-21 11:51 PM Re: Shell command using a variable
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Please review this link and if you still need assistance please let us know. Either way please let us know if you got it working or if you need further assistance.

You need to have WinZip 9.0 with the Command-Line Add-on in order to have good success with this, otherwise I'd recommend another method, perhaps .CAB as Lonkero suggests in this other thread.
 
I would also probably use SELECT CASE myself instead of so many If statements. Either one will work though. 

WinZip Command Line Support - Download
http://www.winzip.com/downcl.htm

 
Please review this thread.
 
Recursive Zip

Top
#118465 - 2004-04-22 12:03 AM Re: Shell command using a variable
MGilhouse Offline
Fresh Scripter

Registered: 2001-11-09
Posts: 5
Thanks NTDOC. I will certainly give this a whirl in the morning, I read the entire thread it looks like you really helped that Phoenix guy! Yes, I am running WinZip 9.0 (registered) with the Command Line Utility version (latest, I just downloaded and reinstalled the CLI last week). I've been using that utility for a while now and love it but there's always something else you have to be able to do, isn't there??
If you want a good laugh I have to email these files out afterward... (I don't even allow ZIP files to come into our mail server anymore!!). Anyhow I'll give it a run in the morning and post back! Thanks!!

Top
#118466 - 2004-04-22 09:51 PM Re: Shell command using a variable
MGilhouse Offline
Fresh Scripter

Registered: 2001-11-09
Posts: 5
Just checking back in.... I tried the script you provided and it worked. Thank you so much much!!!


Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.159 seconds in which 0.097 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org