home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / recipe.sit / Recipe / card_3631.txt < prev    next >
Text File  |  1990-12-14  |  7KB  |  248 lines

  1. -- card: 3631 from stack: in
  2. -- bmap block id: 2359
  3. -- flags: 4000
  4. -- background id: 2785
  5. -- name: First Card
  6.  
  7.  
  8. -- part 1 (button)
  9. -- low flags: 00
  10. -- high flags: 0000
  11. -- rect: left=386 top=234 right=294 bottom=473
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 1
  15. -- font id: 0
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: Import
  20. ----- HyperTalk script -----
  21. --Universal Import Button by Gary Bond
  22. --Copyright 1987 by Apple Computer, Inc.
  23. --Rev 3.1
  24. --Adapted by Stan van de Burgt
  25.  
  26. on MouseUp
  27.   global CARDCOUNT,STARTCARD,LEVELMEMORY
  28.  
  29.   answer "Import new recipes from rec.food.recipes?" with "Yes" or "No"
  30.   if it is "Yes" then
  31.     put the userLevel into LEVELMEMORY
  32.     set the userLevel to 5
  33.     set lockMessages to true
  34.     set lockScreen to true
  35.     put the short id of this card into STARTCARD
  36.     ImporText
  37.     go to next card
  38.     CleanExit "Compact"
  39.   end if
  40. end MouseUp
  41.  
  42. on ImporText
  43.   global CARDCOUNT,STARTCARD,LEVELMEMORY,HEADER,FILENAME
  44.   put 0 into CARDCOUNT
  45.   repeat
  46.     get StdGet ("TEXT")
  47.     if it is empty then CleanExit
  48.     if short name of this stack is not in it then exit repeat
  49.     else answer "Can't import current stack!"
  50.   end repeat
  51.   put it into FILENAME
  52.   set cursor to 4  -- use system watch cursor
  53.  
  54.   open file FILENAME
  55.   repeat
  56.     read from file FILENAME until return
  57.     if it is empty and CARDCOUNT is 0 then
  58.       answer "Could not find file:" && FILENAME with "OK"
  59.       close file FILENAME
  60.       CleanExit
  61.     end if
  62.     if it is empty then exit repeat
  63.  
  64.     put "dunno" into HEADER
  65.     repeat
  66.       if first char of it is "
  67.       " then delete first char of it
  68.       if "from rec.food.recipe" is in it then
  69.         doMenu "New Card"
  70.         put "ΓÇóΓÇóΓÇó Credits ΓÇóΓÇóΓÇó" & return into fld "Credits"
  71.         add 1 to CARDCOUNT
  72.         put "yes" into HEADER
  73.       else -- not the beginning of a new item
  74.         if HEADER is "yes" then
  75.           if first word of it is "Subject:" then
  76.             delete word 1 of it
  77.             put word 1 of it into fld "Type"
  78.             if last char of fld "Type" is ":" then delete last char of fld "Type"
  79.             delete word 1 of it
  80.             put it into fld "Title"
  81.             put "[" & CARDCOUNT & "]" && it
  82.           else -- not the subject
  83.             if first word of it is "From:" or first word of it is "Date:" or first word of it is "Keywords:" then
  84.               put it after fld "Credits"
  85.             else
  86.               if last char of first word of it is not ":" then put "no" into HEADER
  87.             end if
  88.           end if
  89.         else -- not a header line
  90.           if length of it > 65 then
  91.             delete last char of it
  92.             put space after it
  93.           end if
  94.           put it after fld "Recipe"
  95.         end if
  96.       end if
  97.  
  98.       read from file FILENAME until return
  99.       if it is empty then exit repeat
  100.     end repeat
  101.   end repeat
  102.   close file FILENAME
  103.   go card id STARTCARD
  104. end ImporText
  105.  
  106. on CleanExit
  107.   global LEVELMEMORY
  108.   if param(1) is "Compact" then
  109.     put "Compacting..."
  110.     doMenu "Compact Stack"
  111.   end if
  112.   choose browse tool
  113.   set the userLevel to LEVELMEMORY
  114.   set lockScreen to false
  115.   set lockMessages to false
  116.   hide message box
  117.   exit to hypercard
  118. end CleanExit
  119.  
  120.  
  121. -- part contents for background part 13
  122. ----- text -----
  123.  
  124. 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.
  125.  
  126.  
  127.  
  128.  
  129. Stan van de Burgt
  130. Potgieterstraat 37
  131. 3532 VP Utrecht
  132. the Netherlands
  133. Email: SP_vdBurgt@pttrnl.nl
  134.  
  135.              ΓÇóΓÇóΓÇó┬ámore info below ΓÇóΓÇóΓÇó
  136. FIELDS
  137.  
  138. Each card has three field on it:
  139. ΓÇó┬áthe title
  140. ΓÇó the category (BEEF, OVO-LACTO, ...)
  141. ΓÇó the recipe itself
  142. ΓÇó┬áthe credits (this field is hidden until
  143.   you hit the credits button)
  144.  
  145. IMPORTING RECIPES
  146.  
  147. One can import recipes from the UseNet group
  148. rec.food.recipes by clicking the picture
  149. to the right of this text. The articles in
  150. this group should be saved in a file first.
  151.  
  152. When importing from rec.food.recipes, the
  153. title and category fields are filled using
  154. the "Subject:" line of the article.
  155. The "From:", "Date:" and "Keywords:" header
  156. fields of the article are saved in a (hidden)
  157. credits field. This field can be inspected
  158. by clicking the second button at the bottom.
  159. The recipe field of each card is filled with
  160. the body of the UseNet article.
  161.  
  162.  
  163. BUTTONS
  164.  
  165. There are ten buttons just below the main
  166. text box (this one). From left to right
  167. the buttons are:
  168.  
  169. ΓÇó┬áthe "Home" card button
  170. ΓÇó the info button which shows the credits
  171.   for the current card.
  172. ΓÇó a button that brings you to this card.
  173. ΓÇó┬áa button that brings you to the table 
  174.   of contents.
  175. ΓÇó a button that pops up a calculator.
  176. ΓÇó a button to print the recipe
  177. ΓÇó a button to sort the stack
  178. ΓÇó a button to move to the previous card
  179. ΓÇó and one to move to the next
  180. ΓÇó and finaly one "return" button
  181.  
  182. Additionally, an "unlock" button is present in the 
  183. top right corner to make the recipe text editable.
  184.  
  185. On the current card an additional button
  186. (the picture to the right of this text)
  187. can be selected to import a file with 
  188. messages from the UseNet group rec.food.recipes
  189. The file can be obtained by saving articles 
  190. in this group.
  191.  
  192. The catagory field can be clicked to jump to
  193. another card in this catagory. This can only be
  194. used when the card is locked.
  195.  
  196. The recipe count field on the table of
  197. contents card can be clicked to regenerate
  198. the table of contents.
  199.  
  200.  
  201. NOTES:
  202.  
  203. (1) When the name of the recipe is too long
  204.     and it wraps in the table of contents
  205.     the "click and go" algorithm of the table
  206.     of contents card will fail.
  207. (2) When the category field is empty, the title
  208.     will not show up in the table of contents.
  209. (3) The imported cards will need some post
  210.     editing in general. This can be done by
  211.     clicking the lock icon in the top right 
  212.     corner.
  213. (4) The file with saved articles will not need
  214.     any preprocessing, extraneous linefeeds will
  215.     be deleted. The file type has to be 'TEXT'.
  216. (5) The import algorithm assumes that each
  217.     message containing a recipe starts with a
  218.     line "From rec.food.recipes" and that the
  219.     recipe itself starts on the first line that
  220.     doesn't begin with a mail header word, that
  221.     is, a word followed by a colon (":")
  222.  
  223. CREDITS
  224.  
  225. This stack is "Happyware": If you like it,
  226. send me a post card of your home town.
  227.  
  228. Stan van de Burgt
  229. Potgieterstraat 37
  230. 3532 VP Utrecht
  231. the Netherlands
  232. Email: SP_vdBurgt@pttrnl.nl
  233.  
  234.  
  235.  
  236. -- part contents for background part 14
  237. ----- text -----
  238. ΓÇóΓÇóΓÇó Recipe Stack ΓÇóΓÇóΓÇó
  239.  
  240.  
  241. -- part contents for background part 20
  242. ----- text -----
  243.              ΓÇóΓÇóΓÇó┬áRecipe Stack ΓÇóΓÇóΓÇó
  244.                   Stan van de Burgt
  245.               SP_vdBurgt@pttrnl.nl
  246.  
  247.  
  248. Special thanks to everyone contributing to rec.food.recipe.