home *** CD-ROM | disk | FTP | other *** search
- /*
- This genie allows you to print to a "Dot-Matrix" (i.e. non-PostScript) printer with different offsets for alternate pages.
- Written by Don Cox June 93. Not Public Domain.
- */
-
-
- cr = '0a'x
- address command
- call SafeEndEdit.rexx()
- units = ppm_GetUnits()
- if units = 3 then call ppm_SetUnits(2)
- currentoffset = ppm_GetDMOffset()
-
- signal on halt
- signal on break_c
- signal on break_e
- signal on break_d
-
- cu = "in"
- if units = 2 then cu = "cm"
-
- call ppm_AutoUpdate(0)
-
- trace r
-
- source = ppm_Inform(3,"Settings from...","Same again","Type Them In","Disk file")
-
- totalpages = ppm_Numpages()
-
- formstring = ""
-
- if source = 0 then do
- if open("temp","ram:offprint.data","R") then do
- formstring = readch("temp",512)
- call close("temp")
- end
- if formstring = "" then source = 1 /* defaults if failed */
- end /* source = 0 */
-
- if source = 2 then do
- loadfile = ppm_GetFileName("Load settings from disk","PPage:","")
- if loadfile = "" then break
- if open("loader",loadfile,"R") then do
- formstring = readch("loader",512)
- call close("loader")
- end
- if formstring = "" then source = 1 /* go for defaults */
- end
-
- if formstring = "" then formstring ="Xoffset, p.1 ("cu"):0"||cr"YOffset, p.1 ("cu"):0"||cr||"Xoffset, p.2 ("cu"):0"||cr"YOffset, p.2 ("cu"):0"||cr"save settings? (Y/N):N"
-
-
- form = ppm_GetForm("Print with Offsets", 12, formstring)
- if form = '' then exit_msg("Give Up")
-
- parse var form Xoffset1 '0a'x Yoffset1 '0a'x Xoffset2 '0a'x Yoffset2 '0a'x Saving
-
-
- if Xoffset1 = '' then Xoffset1 = 0
- if Yoffset1 = '' then Yoffset1 = 0
- if Xoffset2 = '' then Xoffset2 = 0
- if Yoffset2 = '' then Yoffset2 = 0
- saving = upper(saving)
- if saving ~= 'Y' then saving = "N"
-
- if ~(datatype(Xoffset1, n)) then exit_msg("Invalid Entry for Xoffset1: "Xoffset1)
- if ~(datatype(Yoffset1, n)) then exit_msg("Invalid Entry for Yoffset1: "Yoffset1)
- if ~(datatype(Xoffset2, n)) then exit_msg("Invalid Entry for Xoffset2: "Xoffset2)
- if ~(datatype(Yoffset2, n)) then exit_msg("Invalid Entry for Yoffset2: "Yoffset2)
-
-
- formstring ="Xoffset, p.1 ("cu"):"Xoffset1||cr"YOffset, p.1 ("cu"):"Yoffset1||cr||"Xoffset, p.2 ("cu"):"Xoffset2||cr"YOffset, p.2 ("cu"):"Yoffset2||cr"save settings? (Y/N):"saving
-
-
- if open("temp","ram:offprint.data","W") then do
- call seek("temp",0,"B")
- call writech("temp",formstring)
- call close("temp")
- end
-
- if upper(Saving) = "Y" then do
- savefile = ppm_GetFileName("Save settings to disk","PPage:","")
- if savefile = "" then break
- if open("saver",savefile,"W") then do
- call writech("saver",formstring)
- call close("saver")
- end
- end
-
- do i=1 to totalpages
- call ppm_SetDMOffset(Xoffset1, Yoffset1)
- call ppm_ShowStatus(" Printing Page "i)
- call ppm_PrintPageDM(i,1,1)
- i=i+1
- if i>totalpages then break
- call ppm_ShowStatus(" Printing Page "i)
- call ppm_SetDMOffset(Xoffset2, Yoffset2)
- call ppm_PrintPageDM(i,1,1)
- end
-
- call ppm_SetDMOffset(word(currentoffset,1), word(currentoffset,2))
- call exit_msg("Done")
-
-
- break_d:
- break_e:
- break_c:
- halt:
- call exit_msg("User aborted Genie!")
-
- exit_msg: procedure expose units
- do
- parse arg message
-
- if message ~= '' then call ppm_Inform(1, message,"Resume")
- call ppm_ClearStatus()
- call ppm_SetUnits(units)
- call ppm_AutoUpdate(1)
- exit
- end
-