/* Copy_Spread.rexx */ /* Copy the color spread from the FACE top & bottom colors, */ /* or from the BORDER top & bottom colors to a file on disk. */ /* Position the entry cursor on the item being copied from. */ /* The color spread is saved in the 'CG/ColorSpreads' directory. */ /* A default spread file called 'PasteSpread' can be */ /* used for quick copying and pasting of color spreads. */ /* Use 'Paste_Spread.rexx' to paste the saved color gradient to selected items. */ /* Requires Toaster_CG v4.03 */ /* By Ross Fenmore © 1995 Light Source Video & Graphics */ SIGNAL ON ERROR SIGNAL ON SYNTAX CALL addlib(CG_AREXX,0) outdir='Toaster:Arexx/CG/ColorSpreads' version='CopySpread v1.0' CALL req_bar("Copy a Color Spread...") testdir=pragma('D',outdir) IF testdir="" THEN DO CALL req_tell(outdir,"Directory not found") CALL OUTAHERE END item=1 item=req_string("1- Face 2- Border 0- Cancel",item) IF item="" THEN item=1 IF ~datatype(item,'N') THEN DO CALL req_tell("You must enter a number for color spread source") CALL OUTAHERE END SELECT WHEN item=0 THEN DO CALL req_tell("CopySpread Cancelled") CALL OUTAHERE END WHEN item=1 THEN DO topcolor=translate(get_char(TOPR),","," ") botcolor=translate(get_char(BOTR),","," ") END WHEN item=2 THEN DO topcolor=translate(get_bord(TOPR),","," ") botcolor=translate(get_bord(BOTR),","," ") END OTHERWISE DO CALL req_tell("You must enter [1 or 2] for [FACE or BORDER]") CALL OUTAHERE END END defaultfile="PasteSpread" filename=req_file("Enter Save Name for Spread",defaultfile,outdir) path=FilenameExtract('"'filename'"','P') file=FilenameExtract('"'filename'"','F') IF file="" THEN DO CALL req_tell("You must enter a filename") CALL OUTAHERE END IF exists(filename) & ~(file="PasteSpread") THEN DO answer=req_ask('"'filename'"'||" already exists. Write Over File?") IF answer=0 THEN DO CALL req_tell("Save Canceled") CALL OUTAHERE END END IF (~open(outfile, filename, 'W')) THEN DO CALL req_tell("Unable to open "||'"'||filename||'"') CALL OUTAHERE END CALL writeln outfile, version CALL writeln outfile, topcolor CALL writeln outfile, botcolor CALL writeln outfile, item CALL close outfile CALL req_tell("Color Spread Saved") CALL OUTAHERE EXIT /* Return the path or filename portion of a full path filename */ /* ARGS: '"'fullfilename'"' (surrounded by quotes) */ /* key = 'F' for file; 'P' for path */ FilenameExtract: PROCEDURE PARSE arg '"'fullname'"',key . if lastpos('/',fullname,length(fullname)-1)~=0 then do filename=right(fullname,(length(fullname)-lastpos('/',fullname,length(fullname)-1))) path=left(fullname,(lastpos('/',fullname,length(fullname))-1)) end else do filename=right(fullname,(length(fullname)-lastpos(':',fullname,length(fullname)-1))) path=left(fullname,(lastpos(':',fullname,length(fullname)))) end IF upper(left(key,1)) = 'F' THEN RETURN filename IF upper(left(key,1)) = 'P' THEN RETURN path RETURN "" OUTAHERE: CALL req_bar("Toaster CG") CALL remlib(CG_AREXX) EXIT ERROR: SYNTAX: errorcode = rc line=SIGL text='"'errortext(errorcode)'"' call req_tell("ERROR= "||errorcode,"On line# "||line,text) exit