All pastes #971450 Raw Edit

Stuff

public text v1 · immutable
·published 2008-04-04 19:13 UTC
rendered paste body
tell application "TextEdit"
	set theText to the text of the front document as string
	set x to the number of words in theText
end tell

set counter to 0
set theMats to ""
set theNext to false
repeat x times
	set counter to counter + 1
	set theWord to word counter of theText
	if theNext is true then
		if theMats is "" then
			set theMats to theWord
		else
			set theMats to theMats & " " & theWord
		end if
		set theNext to false
	end if
	if theWord is "name" then set theNext to true
end repeat
set AppleScript's text item delimiters to " "
set theMats to text items of theMats
set AppleScript's text item delimiters to ""

set counter to 0
set theOut to ""
set posx to -400
set posy to -360

repeat (number of items in theMats) times
	set counter to counter + 1
	set posx to posx + 40
	if posx is 360 then set posy to posy + 40
	if posx is 360 then set posx to -360
	
	set theOut to theOut & "

meshbox
   pos " & posx & " " & posy & " 0
   size 10 10 10
   matref " & item counter of theMats & "
end"
end repeat

set theText to (theText & return & return & theOut) as string

tell application "TextEdit"
	set the text of document 1 to theText
end tell