PRODUCT : QUATTRO PRO NUMBER : 393 VERSION : 1.0 OS : DOS DATE : August 10, 1990 PAGE : 1/4 TITLE : DELREAD: A MACRO FOR IMPORTING ASCII DELIMITED FILES DELREAD provides a means for importing ASCII delimited files longer than 256 characters into Quattro Pro. It even allows you to define the type of delimiters used in your file. The DELREAD macro is centered around a Main Menu. The DELREAD Menu ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Only Commas Import º º Comma & Quote Delimited Import º º X & Y Delimited Import º º Quit º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Menu Item Description ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ Only Commas Import Imports a file in which the fields are separated by commas. Example: 1,alpha,beta 2,3,4,5,6 Comma & Quote Delimited Import Imports a file in which the fields are separated by commas, and labels are enclosed by quotes ("). Example: 1,"alpha","beta" 2,3,4,5,6 X & Y Delimited Import Imports a file in which the fields are separated by the symbol X (which you define), and labels are enclosed by the symbol Y (which you also define). Example: 1XYalphaYXYbetaY 2X3X4X5X6 Quit Exits the macro. ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ PRODUCT : QUATTRO PRO NUMBER : 393 VERSION : 1.0 OS : DOS DATE : August 10, 1990 PAGE : 2/4 TITLE : DELREAD: A MACRO FOR IMPORTING ASCII DELIMITED FILES How to enter this macro: 1. Open a blank spreadsheet. 2. Type the following labels into the cells listed next to them: TEMP A1 CURRENT A2 HOME A3 COLCOUNT A4 POSITION A5 DELIMITER A6 FILENAME A7 QUOTE A8 PRINTED? A9 \I A11 IMPORTER A13 IMPORT A19 LOOP A24 OUTPUTCELL A30 OUTPUTLABEL A38 FINISH A44 NEXTLINE A49 OUTPUTLABEL_NL A59 3. Issue the command , type A1..A59 when prompted for the block, and press . This creates all of the block names the macro will need in order to execute properly. 4. Type in the macro commands listed under "The DELREAD Macro." Do not worry if some of the formulas entered display ERR. The macro will recalculate them as it proceeds through the import. 5. Select: . 6. Save the file with a file extension of .WQ1 or .WQ! (for example, DELREAD.WQ!. Now the DELREAD macro is ready for use. PRODUCT : QUATTRO PRO NUMBER : 393 VERSION : 1.0 OS : DOS DATE : August 10, 1990 PAGE : 3/4 TITLE : DELREAD: A MACRO FOR IMPORTING ASCII DELIMITED FILES 7. Bring up the spreadsheet you wish to import data into using . 8. Move to the upper left-hand corner of the block you wish to have the imported data placed into. 9. Press: Alt-I. 10. The macro menu will appear and you may choose the options which are appropriate to your situation. The DELREAD Macro B11: '{let printed?,0}{menubranch importer} B13: 'Only Commas Import B14: 'Import a file with fields separated by commas. B15: '{let QUOTE,""} B16: '{let delimiter,","} B17: '{import}{menubranch importer} B19: '{getlabel "Name of File to Import: ",filename} B20: '{open filename,"r"}{beep}{beep}{branch import} B21: '{indicate "WAIT"}{windowsoff}{paneloff} B22: '{let colcount,0}{let current,""}{let home, @cellpointer("address")} B23: '{branch loop} B24: '{read 1,temp}{branch finish} B25: '{if temp=delimiter}{branch outputcell} B26: '{if temp=@char(10)#or#temp=@char(13)}{branch nextline} B27: '{let current,current&temp} B28: '{branch loop} B30: '{recalccol b1..b65} B31: '{if @left(@trim(current),1)=QUOTE #AND# @right( @trim(current), 1) = QUOTE}{branch outputlabel} B32: +"{if @iserr(@value(current))}{let "&@CELLPOINTER("address")&", current}" B33: +"{if #not#@iserr(@value(current))}{let "&@CELLPOINTER("address")&", @value(current)}" B34: '{let current,""} B35: '{let colcount,colcount+1} B36: '{right}{branch loop} B38: '{recalccol b1..b65} PRODUCT : QUATTRO PRO NUMBER : 393 VERSION : 1.0 OS : DOS DATE : August 10, 1990 PAGE : 4/4 TITLE : DELREAD: A MACRO FOR IMPORTING ASCII DELIMITED FILES B39: +"{let "&@CELLPOINTER("address")&", @mid(current, 1, @length(current)-2)}" B40: '{let current,""} B41: '{let colcount,colcount+1} B42: '{right}{branch loop} B44: '{panelon}{windowson}{close}{recalccol b1..b65} B45: '{indicate}{goto} B46: +HOME&"~" B47: '{menubranch importer} B49: '{recalccol b1..b65}{let printed?,0} B50: '{if colcount=0#AND#current=""}{branch loop} B51: '{if @left(@trim(current),1) = QUOTE #AND# @right( @trim(current), 1) = QUOTE}{branch outputlabel_nl} B52: +"{if @iserr(@value(current))}{let "&@CELLPOINTER("address")&", current}{let printed?, 1}" B53: +"{if #not# @iserr(@value(current))}{let "&@CELLPOINTER("address")&", @value(current)}{let printed?, 1}" B54: +"{if printed?=0}{let "&@CELLPOINTER("address")&",current}" B55: '{let current,""}{left colcount} B56: '{let colcount,0} B57: '{down}{branch loop} B59: '{recalccol b1..b65} B60: +"{let "&@CELLPOINTER("address")&", @mid(current, 1, @length(current)-2)}" B61: '{let current,""}{left colcount} B62: '{let colcount,0} B63: '{down}{branch loop} C13: 'Comma & Quote Delimited Import C14: 'Import file with comma separated fields, and labels in quotes. C15: '{let QUOTE,""""} C16: '{let delimiter,","} C17: '{import}{menubranch importer} D13: 'X & Y Delimited Import D14: 'Import file with X separated fields, and labels in Y's. D15: '{getlabel "Enter the symbol which separates fields: ", delimiter} D16: '{getlabel "Enter the symbol which encloses labels: ",QUOTE} D17: '{import}{menubranch importer} E13: 'Quit E14: 'Exit the macro E15: '{quit}