/* StandardLabels - Prints labels from FinalData's STANDARD Name/Address database */ /* SoftWood, Inc. - by Dick Skraly - June, 1994 */ /* Use of this macros is strictly at the user's risk */ /* ASSUMES: - Current window is a "STANDARD" label database */ /* (ie created by 'Build Standard Name-Address' AREXX macro */ /* - The six column names have not changed */ /* - User is familiar with AREXX - NO TECHNICAL SUPPORT FOR AREXX */ /* - executable from FinalData only (not from CLI) */ /* - Labels are 3.5" by 15/16" (OR 35 char by 6 lines - 1 across) */ /* 7" by 15/16" (OR 70 char by 6 lines - 2 across) */ /* 10.5" by 15/16" (OR 105 char by 6 lines - 3 across) */ /* 14" by 15/16" (OR 140 char by 6 lines - 4 across) */ /* EXIT RC: - 0 = OK, no errors */ /* - 1 = ERROR, not a STANDARD Name/Address database */ /* - 2 = ERROR, the Column names are not STANDARD */ /* - 3 = ERROR, invalid entry for number across requestor */ /* - 4 = ERROR, not called from FinalData */ /* - 5 = ERROR, user cancel */ /* $VER: FDStandardLabels 1.1 (22.7.94) */ /* --------------------------------------------------------------------------- */ /* ----- Variables that you change for printing STANDARD database labels ----- */ /* --------------------------------------------------------------------------- */ MacroLines = '6' /* defines the height (in lines) of the label */ MacroAcross = '1' /* defines the number of horizontal labels across 1 page (default only - may be changed below) */ MacroCopies = '1' /* defines the number of label sets to print */ MacroLabelWidth = '35' /* defines the physical width (in characters -or- 3.5") of each label */ MacroPrintWidth = '33' /* defines the printing width (in characters -or- 3.3") of each label */ MacroPerpage = 'One' /* defines whether the label is a page ('One') or a page has multiple labels ('Multiple') */ MacroDown = '1' /* defines the number of vertical labels (only if MacroPerpage is 'Multiple' */ MacroSkip = '0' /* defines the number of lines to skip after 1 page (only if MacroPerpage is 'Multiple' */ MacroColName.1 = 'First Name' MacroColName.2 = 'Last Name' MacroColName.3 = 'Address' MacroColName.4 = 'City' MacroColName.5 = 'State' MacroColName.6 = 'Zip Code' /* ----- Initialization and make sure called from FinalData -----*/ Options Results HOST=ADDRESS() ADDRESS VALUE HOST if LEFT(HOST,7) ~== 'FINALD.' then EXIT 4 SelectOff /* ----- Init variables ----- */ NumRows AllRows = Result NumColumns AllCols = Result if (AllCols ~= 6) then AllRows = 0 /* Forces error below */ if (AllRows == 0) then do Showmessage 1 0 '"STANDARD LABELS - ERROR 1:" "This is not a STANDARD Name/Address database," "-or- the database is empty." "Abort" "" ""' exit 1 end /* ----- Find Column Names ----- */ x=0 do i=1 to AllCols GetColumnName POSITION i select when Result == MacroColName.1 then x = x + 1 when Result == MacroColName.2 then do x = x + 10 LastNameCol=i end when Result == MacroColName.3 then x = x + 100 when Result == MacroColName.4 then x = x + 1000 when Result == MacroColName.5 then x = x + 10000 when Result == MacroColName.6 then do x = x + 100000 ZipCodeCol=i end otherwise NOP end end if x ~= '111111' then do Showmessage 1 0 '"ERROR: 2" "The Column names are not STANDARD!" "" "Abort" "" ""' exit 2 end /* ----- Ask for labels across ----- */ RequestText '"STANDARD LABELS:" "How many labels ACROSS (1-4)?" 'MacroAcross'' if RC=5 then exit 5 Result = STRIP(Result) select when Result='1' then MacroAcross=1 when Result='2' then MacroAcross=2 when Result='3' then MacroAcross=3 when Result='4' then MacroAcross=4 otherwise do Showmessage 1 0 '"STANDARD LABELS - ERROR 2:" "Not a valid entry," "Valid entries are 1 thru 4 only." "Abort" "" ""' exit 3 end end if MacroAcross > 1 then MacroPerpage='Multiple' /* ----- P R I N T P R E F S ----- */ GetPrintPrefs QUALITY PITCH SPACING DEVICE PAPERFEED FILENAME PARSE VAR Result OldQuality OldPitch OldSpacing OldDevice OldPaperFeed OldFileName NewPitch = 'Pica' NewSpacing = 'Six' NewDevice = 'Printer' SetPrintPrefs QUALITY OldQuality PITCH NewPitch SPACING NewSpacing DEVICE NewDevice PAPERFEED OldPaperFeed FILENAME OldFileName /* ----- L A B E L P R E F S ----- */ GetLabelPrefs COPIES LABELWIDTH LABELHEIGHT LABELSPERPAGE LABELSACROSS LABELSDOWN PRINTWIDTH SKIP PARSE VAR Result OldCopies OldLabelwidth OldLabelheight OldLabelsperpage OldLabelsacross OldLabelsdown OldPrintwidth OldSkip ClearLabel SetLabelPrefs COPIES MacroCopies PRINTWIDTH MacroPrintWidth LABELWIDTH MacroLabelWidth LABELHEIGHT MacroLines LABELSPERPAGE MacroPerpage LABELSACROSS MacroAcross LABELSDOWN MacroDown SKIP MacroSkip /* ----- Set Label defines ----- */ SetLabelDef 5 1 1 Space /* 5 = First Name Col. */ SetLabelDef 4 1 2 None /* 4 = Last Name Col. */ SetLabelDef 3 2 1 None /* 3 = Address Col. */ SetLabelDef 2 3 1 CommaSpace /* 2 = City Col. */ SetLabelDef 1 3 2 Space /* 1 = STate Col. */ SetLabelDef 0 3 3 None /* 0 = Zip Code */ /* ----- SORT? ----- */ Showmessage 1 0 '" S O R T by:" "Zip Code, Last Name?" "" "Yes" "No" "Abort"' if Result = 3 then exit 0 if Result = 1 then do if AllRows > 1 then do ClearSort AddColumnToSort ZipCodeCol AddColumnToSort LastNameCol SortRows end end /* ----- P r i n t ----- */ /**************************************************************/ /**************************************************************/ /**************************************************************/ PrintLabels /**************************************************************/ /**************************************************************/ /**************************************************************/ /* ----- Reset Prefs back to prior settings ----- */ SetLabelPrefs COPIES OldCopies PRINTWIDTH OldPrintwidth LABELWIDTH OldLabelwidth LABELHEIGHT OldLabelheight LABELSPERPAGE OldLabelsperpage LABELSACROSS OldLabelsacross LABELSDOWN OldLabelsdown SKIP OldSkip SetPrintPrefs QUALITY OldQuality PITCH OldPitch SPACING OldSpacing DEVICE OldDevice PAPERFEED OldPaperFeed FILENAME OldFileName exit RC /****** end of StandardLabel ********************/