August 23, 2006 at 8:30 am
Is there any way I can zip up files within an ActiveX script?
Thanks,
Ninel
August 24, 2006 at 1:21 am
You have to download a third party zip program like http://www.7-zip.org or http://www.freebyte.com/fbzip/ and shell out from the package or write your own in .Net
August 24, 2006 at 7:42 am
Absolutely. We used winzip and command line parameters in our task.
Regards,
Matt
August 24, 2006 at 8:13 am
Hi
You could also try sawzip...Do a search on google for it.
Mike
August 25, 2006 at 8:15 am
I have the following code within the ActiveX: script:
sRptFileName = "\\ititpafs01\pds\INETPUB\FTPROOT\accumen\Political\" & iRowCount1.Value & ".xls"
Dim vCsvFile
Dim vZipFile
Dim mcrZip
vCsvFile = "\\ititpafs01\pds\INETPUB\FTPROOT\accumen\Political\" & iRowCount1.Value & ".xls"
vZipFile = "\\ititpafs01\pds\INETPUB\FTPROOT\accumen\Political\" & iRowCount1.Value & ".zip"
mcrZip = "RUN l:\voicenet\isiti\winzip\wzzip.exe " & vZipFile & " " & vCsvFile
SHELL(mcrZip)
This is not working.
Can someone please help me out?
Thanks,
Ninel
August 25, 2006 at 9:12 am
rookie,
two things first you need to install the winzip command line add on's, these do not come with winzip but they are free. here is the link http://www.winzip.com/prodpagecl.htm . download the add on's then view the read me file. they do a nice job of telling oyu all the command zine switches and hwo to use them, good luck
August 25, 2006 at 10:05 am
I found another way of running this. I'm testing in query analyzer before running it in the ActiveX script.
The xls file is about 358 kb and contains about 1569 rows.
I am using the following code:
[Code]
Use master
DECLARE @result varchar(200)
EXEC @result = xp_cmdshell '\\ITITPAFS02\pds\voicenet\isiti\winzip\wzzip.exe \\ititpafs01\pds\inetpub\ftproot\accumen\political \at0123.zip \\ititpafs01\pds\inetpub\ftproot\accumen\political \at0123.xls'
IF (@result = 0)
PRINT 'success'
ELSE
PRINT 'Failure'
[/code]
It runs longer than 9 min. I just kill it. Am I doing something wrong?
Thanks,
Ninel
August 25, 2006 at 10:19 am
Try running it from the command line and see what happens.
Use just '\\ITITPAFS02\pds\voicenet\isiti\winzip\wzzip.exe \\ititpafs01\pds\inetpub\ftproot\accumen\political \at0123.zip \\ititpafs01\pds\inetpub\ftproot\accumen\political \at0123.xls'
You maybe running into rights issues crossing servers.
Regards,
Matt
August 25, 2006 at 10:40 am
matt is correct could be permissions. here is what i would do, open command prompt. run your zip command fro mthere if all works great, then use cmdshell as yo uhave stated, if it fails it is most likley do to the sql server agent account not havign permissions to do what it needs to access the other resources, remeber when you run cmdshell it hands of to the sql server agent account.
August 25, 2006 at 10:58 am
The only way it works for me is I do it like this:
1. Connected to the server that this code will be running off of.
2. Saved the excel file to c:\test\at0123.xls
3. Opened command prompt.
4. Typed: cd\ which takes me to the prompt c:\>
5. Then if I typed c:\>"c:\Program files\winzip\wzzip.exe" c:\test\at0123.zip
This zips everything in the c:\test directory.
What I need to do is through the ActiveX script zip up the excel file that sits on server (\\ititpafs01\pds\inetpub\ftproot\accumen\political\) using the wzzip.exe which sits on a different server(\\ITITPAFS02\pds\voicenet\isiti\winzip\wzzip.exe)
August 25, 2006 at 11:01 am
winnzip mus teb sql server where you are running the script task, otherwise this will not work
August 25, 2006 at 11:04 am
If I type what works in the command prompt:
C:\>"c:\program files\winzip\wzzip.exe" c:\test\at0123.zip
into query analyzer:
DECLARE @result int
USE master
EXEC @result = xp_cmdshell '"C:\Program Files\WinZip\wzzip.exe" C:\test\AT0123.zip'
IF (@result = 0)
PRINT 'Success'
ELSE
PRINT 'Failure'
[\code]
It runs and hangs with no results.
August 25, 2006 at 11:06 am
kmlakov - I didn't understand your post. Can you please retype it?
Viewing 13 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic. Login to reply