Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. tell application "OmniOutliner"
  2. activate
  3. try
  4. if not (exists document 1) then error number 10000
  5.  
  6. display dialog "This script will replace the marker (talkingPoints) within the presenter notes of the active slides of the frontmost Keynote presentation, with the contents of this outline." & return & return & "The contents of each row will replace the marker (talkingPoints) within the presenter notes of a corresponding Keynote slide." with icon 1
  7.  
  8. tell application "Keynote"
  9. activate
  10. if not (exists document 1) then error number 10001
  11.  
  12. tell front document
  13. set the slideCount to the count of (slides whose skipped is false)
  14. end tell
  15. end tell
  16.  
  17. tell the front document
  18. set theseOutlinerNotes to the topic of every row
  19. end tell
  20.  
  21. if the (count of theseOutlinerNotes) is greater than the slideCount then
  22. error number 10002
  23. else if the (count of theseOutlinerNotes) is less than the slideCount then
  24. error number 10003
  25. end if
  26. on error errorMessage number errorNumber
  27. if errorNumber is 10000 then
  28. set errorMessage to "No document is open."
  29. else if errorNumber is 10001 then
  30. set errorMessage to "No presentation is open."
  31. else if errorNumber is 10002 then
  32. set errorMessage to ¬
  33. "There are more rows in this document than there are active slides in the presentation."
  34. else if errorNumber is 10003 then
  35. set errorMessage to ¬
  36. "There are fewer rows in this document than there are active slides in the presentation."
  37. end if
  38. if errorNumber is not -128 then
  39. display alert "PREPARATION ERROR" message errorMessage
  40. end if
  41. error number -128
  42. end try
  43. end tell
  44.  
  45. set targetMarker to "talkingPoints"
  46.  
  47. tell application "Keynote"
  48. tell the front document
  49. repeat with i from 1 to the count of slides
  50. tell slide i
  51. tell presenter notes
  52. set (the third paragraph) to ¬
  53. "talkingPoints"
  54. end tell
  55. if presenter notes contains targetMarker then
  56. set targetNotes to (presenter notes as string)
  57. tell application "System Events"
  58. set AppleScript's text item delimiters to targetMarker
  59. set presenterNoteParsed to every text item of targetNotes
  60. set AppleScript's text item delimiters to ""
  61. end tell
  62. set presenterString to (item 1 of presenterNoteParsed) & (item i of theseOutlinerNotes) & (item 2 of presenterNoteParsed)
  63. set presenter notes to presenterString
  64. end if
  65. end tell
  66. end repeat
  67. end tell
  68. end tell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement