Advertisement
Guest User

Untitled

a guest
Nov 12th, 2014
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. if (app.selection.length != 1 || app.selection[0].constructor.name != "TextFrame")
  2. {
  3. alert ("Ground. Pull up. Ground. Pull up."); exit(0);
  4. }
  5. // Save selection
  6. targetStory = app.selection[0].parentStory.texts[0];
  7. // Make a Lorem frame
  8. loremFrame = app.activeDocument.textFrames.add();
  9. loremFrame.geometricBounds = [ "0mm","0mm", "200mm", "200mm" ];
  10. loremFrame.insertionPoints[0].appliedFont = "Times New Roman";
  11. loremFrame.insertionPoints[0].pointSize = 8;
  12. loremFrame.contents = TextFrameContents.PLACEHOLDER_TEXT;
  13. sourceStory = loremFrame.texts[0];
  14. // Grab its words
  15. sourceWords = sourceStory.words.everyItem().contents;
  16. // .. and kill the placeholder
  17. loremFrame.remove(0);
  18. // Replace one word at a time. Start at the end.
  19. sourceWord = 0;
  20. destWord = 0;
  21. while (destWord < targetStory.words.length)
  22. {
  23. targetStory.words[destWord].contents = sourceWords[sourceWord];
  24. destWord++;
  25. sourceWord++;
  26. if (sourceWord >= sourceWords.length)
  27. sourceWord = 0;
  28. }
  29. alert ("Safe landing. Have a nice day.");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement