Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Xstandard.zip 1

Status
Not open for further replies.

Rogy

Programmer
Nov 20, 2002
43
0
0
SI
I've downloaded Xstandard zip component from I want to see(just see!) the list of files of archive.
This is the example from their site:

Dim objZip, objItem
Set objZip = Server.CreateObject("XStandard.Zip")
For Each objItem In objZip.Contents("C:\Temp\images.zip")
Response.Write objItem.Path & objItem.Name & "<br />"
Next
Set objZip = Nothing
Set objItem = Nothing

When i try to write this code in VFP8, i get
"Expression evaluator failed" error message.

How can I convert this to VFP8?
 
Try something like this:

Code:
objZip = CreateObject("XStandard.Zip")
for i = 1 to objZip.Contents("c:\temp\images.zip").count()
	messagebox(objZip.Contents("c:\temp\images.zip").item(i).name )
next

Regards

Griff
Keep [Smile]ing
 
No problem, I don't THINK it is as efficient as the VBScript version - because you probably have to keep opening the zip file to access the contents, I'm guessing this based on the need to keep specifying the filename.

Glad to be of help.

Regards

Griff
Keep [Smile]ing
 
You could try this:
Code:
objZip = CreateObject("XStandard.Zip")
objFiles = objZip.Contents("c:\temp\images.zip")

for i = 1 to objFiles.count()
    messagebox( objFiles.item(i).name )
endfor

( this is untested, but I believe it will work )

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Rogy - wgcs - Griff

Rogy said:
It works!
Thanks!

Really? I cannot get that portion to work myself. It gives me an error at the 'objFiles = objZip.Contents("c:\temp\images.zip")' line, telling me ""Expression evaluator failed"



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,

I think Rogy was refering to the code sample I posted - I'm not sure you can access collections like that in VFP (perhaps in 7/8/9? certainly not 6)

Regards

Griff
Keep [Smile]ing
 
Griff

I think Rogy was refering to the code sample I posted - I'm not sure you can access collections like that in VFP (perhaps in 7/8/9? certainly not 6)

Isn't the code sample you posted VFP code? If so it does not work in any versions of VFP...Too bad, because I discorvered that the unzipping portion failed me this morning and it would have been nice to confirm the presence of the unzipped file on the disk before moving on.




Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Mike,

My short, clumsy, segment does work - I tested it in VFP 6 before I posted it. Which bit of code are you trying? In all fairness I only wanted to read the names of the files, I haven't tried any unzipping from it.

Regards

Griff
Keep [Smile]ing
 
Griff.

Thank you for pointing that out. BTW the zip and unzip portion always worked for me. But the "contents" did not. It was trowing an error. But since you pointed out it worked for you, I redowloaded the dll from the site and reinstalled it, and now it works properly in all versions of VFP. I may have had an older version of the dll. Thanks again.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top