Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


ItemExtract Loop from a Zip or Unzip Return Value

Keywords: 	  ItemExtract

Question:

The new zip extender works real well, even though the functions return an extra tab, so on item counts you have to do an itemcount -1

Is this intentional? code below takes the list and adds them to entries in an ini file.

Everyone should note that the @LF's are now @tabs

	ziplist = zZipFiles("", tmpzip,"\archive\*.ctl","")
	filecount = itemcount(ziplist, @TAB)
	for i = 1 to filecount -1 ;take into account extra tab
		file = itemextract(i+1,ziplist,@TAB)
		IniWritePvt("Files", "CTL %i%",file , "%path%\6920bak.INI")
		IniWritePvt("","","","%path%\6920bak.INI")
	next

Answer:

zZipFiles and zUnZipFiles return an error value for the first item in the list, so here is the revised script.
	ziplist = zZipFiles("", tmpzip,"\archive\*.ctl","")
	filecount = itemcount(ziplist, @TAB)
	for i = 2 to filecount ;take into account extra tab
		file = itemextract(i+1,ziplist,@TAB)
		IniWritePvt("Files", "CTL %i%",file , "%path%\6920bak.INI")
		IniWritePvt("","","","%path%\6920bak.INI")
	next

Article ID:   W12694
Filename:   ItemExtract from a Zip or Unzip Return Value.txt