Advertisement
EkriirkE

HyperCard Addresses Export Script

Jun 14th, 2017
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. ----- Export Text Operations -------------------------------------
  2.  
  3. on exportText
  4. -- Requires handler: writeExportedText
  5. -- Requires function handler: lastHCItem
  6. -- if shiftKey is down use only the marked cards
  7. if the shiftKey is down then
  8. put false into useAllCards
  9. put "from marked cards" & space into prompt -- Æ
  10. put number of marked cards into numCards
  11. else
  12. put true into useAllCards
  13. put empty into prompt
  14. put number of cards in bg "Body" into numCards
  15. end if
  16. ask file "Export text" && prompt & "to the file:" with "Addresses Text File" -- Æ
  17. if the result is "Cancel" or it is empty then exit exportText
  18. put it into fileName
  19. writeExportedText numCards, useAllCards, fileName
  20. if numCards = 1 then put "card" into info -- Æ
  21. else put "cards" into info -- Æ
  22. answer "The text from" && numCards && info && Â
  23. "was exported to the new file Ò" & lastHCItem(":",fileName) & "Ó." -- Æ
  24. end exportText
  25.  
  26. on writeExportedText numCards, useAllCards, fileName
  27. -- Requires function handler: theFields
  28. lock screen
  29. if useAllCards then go card 1 of bg "Body"
  30. else go first marked card
  31. put theFields() into fieldList
  32. open file fileName
  33. repeat with currentCard = 1 to numCards
  34. set cursor to busy
  35. put empty into theText
  36. repeat with i = 1 to (number of items in fieldList - 1)
  37. put value of (item i of fieldList) & tab after theText
  38. end repeat
  39. put SubstituteChar(return,"É", value of (item i + 1 of fieldList)) & Â
  40. tab & return after theText
  41. write theText to file fileName
  42. if not useAllCards then go next marked card
  43. else go next card of this bg
  44. end repeat
  45. close file fileName
  46. unlock screen
  47. end writeExportedText
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement