-- card: 3631 from stack: in -- bmap block id: 2359 -- flags: 4000 -- background id: 2785 -- name: First Card -- part 1 (button) -- low flags: 00 -- high flags: 0000 -- rect: left=386 top=234 right=294 bottom=473 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Import ----- HyperTalk script ----- --Universal Import Button by Gary Bond --Copyright 1987 by Apple Computer, Inc. --Rev 3.1 --Adapted by Stan van de Burgt on MouseUp global CARDCOUNT,STARTCARD,LEVELMEMORY answer "Import new recipes from rec.food.recipes?" with "Yes" or "No" if it is "Yes" then put the userLevel into LEVELMEMORY set the userLevel to 5 set lockMessages to true set lockScreen to true put the short id of this card into STARTCARD ImporText go to next card CleanExit "Compact" end if end MouseUp on ImporText global CARDCOUNT,STARTCARD,LEVELMEMORY,HEADER,FILENAME put 0 into CARDCOUNT repeat get StdGet ("TEXT") if it is empty then CleanExit if short name of this stack is not in it then exit repeat else answer "Can't import current stack!" end repeat put it into FILENAME set cursor to 4 -- use system watch cursor open file FILENAME repeat read from file FILENAME until return if it is empty and CARDCOUNT is 0 then answer "Could not find file:" && FILENAME with "OK" close file FILENAME CleanExit end if if it is empty then exit repeat put "dunno" into HEADER repeat if first char of it is " " then delete first char of it if "from rec.food.recipe" is in it then doMenu "New Card" put "••• Credits •••" & return into fld "Credits" add 1 to CARDCOUNT put "yes" into HEADER else -- not the beginning of a new item if HEADER is "yes" then if first word of it is "Subject:" then delete word 1 of it put word 1 of it into fld "Type" if last char of fld "Type" is ":" then delete last char of fld "Type" delete word 1 of it put it into fld "Title" put "[" & CARDCOUNT & "]" && it else -- not the subject if first word of it is "From:" or first word of it is "Date:" or first word of it is "Keywords:" then put it after fld "Credits" else if last char of first word of it is not ":" then put "no" into HEADER end if end if else -- not a header line if length of it > 65 then delete last char of it put space after it end if put it after fld "Recipe" end if end if read from file FILENAME until return if it is empty then exit repeat end repeat end repeat close file FILENAME go card id STARTCARD end ImporText on CleanExit global LEVELMEMORY if param(1) is "Compact" then put "Compacting..." doMenu "Compact Stack" end if choose browse tool set the userLevel to LEVELMEMORY set lockScreen to false set lockMessages to false hide message box exit to hypercard end CleanExit -- part contents for background part 13 ----- text ----- This is the first card of the Recipe Stack, a stack to import and classify recipes from the UseNet group rec.food.recipes as well as keep track of your own ones. As an example, several recipes that were posted in november 1990 on this news group are included. Stan van de Burgt Potgieterstraat 37 3532 VP Utrecht the Netherlands Email: SP_vdBurgt@pttrnl.nl ••• more info below ••• FIELDS Each card has three field on it: • the title • the category (BEEF, OVO-LACTO, ...) • the recipe itself • the credits (this field is hidden until you hit the credits button) IMPORTING RECIPES One can import recipes from the UseNet group rec.food.recipes by clicking the picture to the right of this text. The articles in this group should be saved in a file first. When importing from rec.food.recipes, the title and category fields are filled using the "Subject:" line of the article. The "From:", "Date:" and "Keywords:" header fields of the article are saved in a (hidden) credits field. This field can be inspected by clicking the second button at the bottom. The recipe field of each card is filled with the body of the UseNet article. BUTTONS There are ten buttons just below the main text box (this one). From left to right the buttons are: • the "Home" card button • the info button which shows the credits for the current card. • a button that brings you to this card. • a button that brings you to the table of contents. • a button that pops up a calculator. • a button to print the recipe • a button to sort the stack • a button to move to the previous card • and one to move to the next • and finaly one "return" button Additionally, an "unlock" button is present in the top right corner to make the recipe text editable. On the current card an additional button (the picture to the right of this text) can be selected to import a file with messages from the UseNet group rec.food.recipes The file can be obtained by saving articles in this group. The catagory field can be clicked to jump to another card in this catagory. This can only be used when the card is locked. The recipe count field on the table of contents card can be clicked to regenerate the table of contents. NOTES: (1) When the name of the recipe is too long and it wraps in the table of contents the "click and go" algorithm of the table of contents card will fail. (2) When the category field is empty, the title will not show up in the table of contents. (3) The imported cards will need some post editing in general. This can be done by clicking the lock icon in the top right corner. (4) The file with saved articles will not need any preprocessing, extraneous linefeeds will be deleted. The file type has to be 'TEXT'. (5) The import algorithm assumes that each message containing a recipe starts with a line "From rec.food.recipes" and that the recipe itself starts on the first line that doesn't begin with a mail header word, that is, a word followed by a colon (":") CREDITS This stack is "Happyware": If you like it, send me a post card of your home town. Stan van de Burgt Potgieterstraat 37 3532 VP Utrecht the Netherlands Email: SP_vdBurgt@pttrnl.nl -- part contents for background part 14 ----- text ----- ••• Recipe Stack ••• -- part contents for background part 20 ----- text ----- ••• Recipe Stack ••• Stan van de Burgt SP_vdBurgt@pttrnl.nl Special thanks to everyone contributing to rec.food.recipe.