Guidance
指路人
g.yi.org
Software / Reginald / Examples / zipexams / ZipVars.rex

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
/* This script shows how to use the RxZip add-on DLL to create a ZIP archive
 * from the contents of some REXX Variables.
 */

OPTIONS "C_CALL LABELCHECK"

/* Register the Rxzip add-on DLL */
LIBRARY rxzip

/* Tell RxZip to raise SYNTAX condition for any failure with a Zip function */
ziperr = "SYNTAX"
zipheading = 1

/* Here are some variables which we'll compress into our zip file */
data1 =	"This is some data." || "0D0A0D0A"x || "This is line two."|| "0D0A"x
data2 =	"This is a test of the RxZip add-on dll." || "0D0A0D0A"x || "Hopefully this worked!"|| "0D0A"x

DO
	/* Create a ZIP archive on disk named "MyTest.zip". Store the ZIP handle
	 * in a variable named "ZipHandle"
	 */
	zipcreate("ZipHandle", "MyTest.zip")

	/* Add the contents of the Data1 to the ZIP, and give it the name "data1.txt". */
	zipadd(ziphandle,  data1, "MEMORY", "data1.txt")

	/* Add the contents of the Data2 to the ZIP, and give it the name "data2.txt". */
	zipadd(ziphandle,  data2, "MEMORY", "data2.txt")

	/* Here we could call ZipAdd to add disk files, the contents of more variables,
	 * or the output of a pipe, to the ZIP archive.
	 */

	/* We're done adding files to our ZIP in memory, so just let the FINALLY section close it. */

	CATCH SYNTAX
		CONDITION('M')

	FINALLY
		/* Make sure any ZIP archive we created above is closed. */
		IF EXISTS("ZIPHANDLE") THEN zipclose(ziphandle)
END
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2024-5-2  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2010-07-16 20:49:38