Advertisement
TheocraticSoftware

Word-Wrap Titles Script.txt

Dec 31st, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. LOOP FROM "Home Talks" NODATERANGE SORTBY "Last Given"
  2. SHORTDATE_FIELD "Last Given"
  3. TAB =6>
  4. FIELD "Talk Number"
  5. TAB =10>
  6.  
  7. // Let us say that we want to show the theme here, wrapped to 35 characters, at tab stop 10.
  8. // The first thing we do is save the talk theme to a variable
  9. VARIABLE_FIELD "Talk Number" "$strTalkTheme#TALK_THEME"
  10.  
  11. // Make a copy of the talk theme variable
  12. $strThemeCopy = $strTalkTheme
  13.  
  14. // How many rows do we need, if we were to wrap at 35 characters (approx)?
  15. $iNumTitleRows = ceil(len($strThemeCopy) / 35)
  16.  
  17. // Loop the required number of rows
  18. LOOP AS $iTitleRowNum FROM 1 TO $iNumTitleRows
  19. // Set the tab stop
  20. TAB =10>
  21.  
  22. // Find the last space prior to the exact split.
  23. $iLastSpace = prev_space($strThemeCopy, 35)
  24.  
  25. // Are we on the last row of the title?
  26. IF "$iTitleRowNum" IS "$iNumTitleRows"
  27. // For the last row, must use all that is left.
  28. $iLastSpace = len($strThemeCopy)
  29. END_IF
  30.  
  31. // This may be a few characters under; subsequent lines will be over.
  32. TEXT "{left($strThemeCopy, $iLastSpace) }"
  33.  
  34. // If this is the first row of the title, then we want to display any other fields now
  35. IF "$iTitleRowNum" IS "1"
  36. TAB =25>
  37. FIELD "Speaker"
  38. END_IF
  39.  
  40. EOL
  41.  
  42. // Update our temporary theme variable
  43. $strThemeCopy = trim(mid($strThemeCopy, $iLastSpace) )
  44.  
  45. END_LOOP
  46. EOL
  47. BLANK *1
  48. END_LOOP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement