home *** CD-ROM | disk | FTP | other *** search
Wrap
/* This genie uses the CMD command to speed up printing of multiple copies to a non-Postscript printer. A second program, CMDcopy, must be present in your Rexx: directory. */ /* $VER: CMDprint Aug 95 */ /*call open("STDERR","ram:traceCMD","W") trace r*/ oldunits = ppm_GetUnits() call ppm_SetUnits(2) /* work in metric throughout */ call ppm_AutoUpdate(0) call SafeEndEdit.rexx() cr="0a"x Autotile = d2y(ppm_GetDMAutotile()) ColorCorrect = d2y(ppm_GetDMColorCorrect()) Dither = ppm_GetDMDither() select when dither = 0 then dither = "O" when dither = 1 then dither = "H" when dither = 2 then dither = "F" otherwise dither = "invalid" end Density = ppm_GetDMDensity() Eject = d2y(ppm_GetDMEject()) Landscape = ppm_GetDMLandscape() select when landscape = 0 then landscape = "P" when landscape = 1 then landscape = "L" otherwise landscape = "invalid" end Offset = ppm_GetDMOffset() OffsetX = word(Offset,1)*10 /* convert to mm */ OffsetY = word(Offset,2)*10 PageSize = ppm_GetDMPageSize() PageWidth = word(PageSize,1)*10 PageHeight = word(Pagesize,2)*10 PrintMode = ppm_GetDMPrintMode() select when PrintMode = 0 then PrintMode = "B" when printmode = 1 then PrintMode = "G" when PrintMode = 2 then PrintMode = "C" otherwise PrintMode = "invalid" end Proof = ppm_GetDMProof() select when Proof = 0 then Proof = "D" when Proof = 1 then Proof = "F" otherwise Proof = "invalid" end Scale = ppm_GetDMScale() ScaleX = word(Scale,1) ScaleY = word(Scale,2) copies = getclip("CMDcopies") if copies = "" then copies = 2 if ~datatype(copies, n) then copies = 2 formstring = "Number of copies:"copies || cr||"Autotile (Y/N):"Autotile ||cr|| "Color Correct(Y/N):"ColorCorrect ||cr|| "Dither (O/H/F):"Dither ||cr|| "Density (1-7):"Density ||cr|| "Eject (Y/N):"Eject ||cr|| "Landscape (L/P):"Landscape ||cr|| "Offset X (mm):"OffsetX ||cr|| "Offset Y (mm):"OffsetY ||cr|| "Pagewidth (mm):"Pagewidth ||cr|| "Page height (mm):"Pageheight ||cr|| "Print mode (B/G/C):"Printmode ||cr|| "Proof (D/F):"Proof ||cr|| "Scale X:"ScaleX ||cr|| "Scale Y:"ScaleY form = ppm_GetForm("Print Specs",14,formstring) parse var form copies '0a'x autotile '0a'x colorcorrect '0a'x dither '0a'x density '0a'x eject '0a'x landscape '0a'x OffsetX '0a'x OffsetY '0a'x Pagewidth '0a'x Pageheight '0a'x Printmode '0a'x proof '0a'x ScaleX '0a'x ScaleY if ~datatype(copies,n) then copies = 2 call setclip('CMDcopies',copies) /* for collection by copy program */ autotile = y2d(autotile) if autotile ~= "invalid" then call ppm_SetDMAutotile(autotile) colorcorrect = y2d(colorcorrect) if colorcorrect ~= "invalid" then call ppm_SetDMColorCorrect(colorcorrect) dither = upper(left(strip(dither),1)) select when dither = "O" then dither = 0 when dither = "H" then dither = 1 when dither = "F" then dither = 2 otherwise dither = ppm_GetDMdither() end call ppm_SetDMdither(dither) if ~datatype(density,n) then density = 4 density = trunc(density) density = max(density,1) density = min(density,7) call ppm_SetDMDensity(density) eject = y2d(eject) if eject ~= "invalid" then call ppm_SetDMeject(eject) landscape = upper(left(strip(landscape),1)) select when landscape = "P" then call ppm_SetDMLandscape(0) when landscape = "L" then call ppm_SetDMLandscape(1) otherwise NOP end if datatype(OffsetX,n) then OffsetX = OffsetX/10 /* convert to cm */ else OffsetX = word(ppm_GetDMOffset(),1) if datatype(OffsetY,n) then OffsetY = OffsetY/10 /* convert to cm */ else OffsetY = word(ppm_GetDMOffset(),2) if datatype(Pagewidth,n) then Pagewidth = Pagewidth/10 else Pagewidth = word(ppm_GetDMPagesize(),1) if datatype(Pageheight,n) then Pageheight = Pageheight/10 else Pageheight = word(ppm_GetDMPagesize(),2) if abs(OffsetX)>Pagewidth then OffsetX = word(ppm_GetDMOffset(),1) if abs(OffsetY)>Pageheight then OffsetY = word(ppm_GetDMOffset(),2) call ppm_SetDMOffset(OffsetX,OffsetY) call ppm_SetDMPageSize(Pagewidth,pageheight) printmode = upper(left(strip(printmode),1)) select when printmode = "B" then printmode = 0 when printmode = "G" then printmode = 1 when printmode = "C" then printmode = 2 otherwise printmode = ppm_GetDMprintmode() end call ppm_SetDMprintmode(printmode) proof = upper(left(strip(proof),1)) select when proof = "D" then call ppm_SetDMproof(0) when proof = "F" then call ppm_SetDMproof(1) otherwise NOP end if ~datatype(ScaleX,n) then ScaleX = word(ppm_GetDMScale(),1) if ~datatype(ScaleY,n) then ScaleY = word(ppm_GetDMScale(),2) call ppm_SetDMSCale(ScaleX,ScaleY) call open('infile',"ENV:Sys/printer.prefs","R") prefbytes = readch('infile',30000) call close('infile') serpar = substr(prefbytes,50,1) if serpar = 1 then pport = "serial" else pport = "parallel" pport2 = left(pport,3)||":" call setclip("CMDpport2",pport2) tempfile = ppm_GetFileName("Set file for temporary storage","RAM:",) if tempfile = "" then exit_msg("Aborted by user") call setclip('CMDtempfile',tempfile) address command 'run >nil: cmd 'pport '"'tempfile'"' call ppm_PrintDocDM(1,1) /*'run >nil: rx CMDcopy.rexx'*/ call exit_msg("Done") exit exit_msg: do parse arg message if message ~= "" then call ppm_Inform(1,message,"Resume") call ppm_ClearStatus() call ppm_PPageToFront() call ppm_AutoUpdate(1) call ppm_SetUnits(oldunits) exit end d2y: procedure /* converts 0 or 1 to N or Y */ parse arg numeral select when numeral = 1 then output = "Y" when numeral = 0 then output = "N" otherwise output = "invalid" end return output y2d: procedure parse arg letter letter = left(strip(letter),1) select when upper(letter) = "Y" then output = 1 when upper(letter) = "N" then output = 0 otherwise output = "invalid" end return output