Hi,
I am writing a script for placing previous text tag in next paragraph where no text tag available. But I am stuck to place in third paragraph or so. I have placed my script below, please help.
tell application “Adobe InDesign CS5.5”
set myDocument to document 1
set myStory to story 1 of myDocument
set myDocument to parent of myStory
set find grep preferences to nothing
set change grep preferences to nothing
set include footnotes of find change grep options to false
set include hidden layers of find change grep options to false
set include locked layers for find of find change grep options to false
set include locked stories for find of find change grep options to false
set include master pages of find change grep options to false
set myFoundWordTextStringList to {}
set myFoundWordTextStringLists to {}
set find what of find grep preferences to “(^<.+?>)(.+\r)(^[^<].+\r)+”
set myStartTags to {“<”}
set myEndTags to {“>”}
set mm to 0
set MyFoundWords to find grep
if (count MyFoundWords) is not equal to 0 then
set myFoundTagsa to {}
repeat with myCounters from 1 to (count MyFoundWords)
set myFoundTagm to contents of item myCounters of MyFoundWords
if myFoundTagsa does not contain myFoundTagm then
copy myFoundTagm to end of myFoundTagsa
end if
repeat with i from 1 to count of myFoundTagsa
set find text preferences to nothing
set change text preferences to nothing
set find what of find text preferences to item i of myFoundTagsa
set selection to find text
repeat with m from 1 to count of every paragraph of selection
set myselect to contents of paragraph m of selection
set find text preferences to nothing
set change text preferences to nothing
set find what of find text preferences to myselect
set selection to find text
if item m of myselect starts with myStartTags then
set find what of find grep preferences to "(^<.+?>)"
set MyFoundWordss to find grep
if (count MyFoundWordss) is not equal to 0 then
set myFoundTags to {}
repeat with myCounter from 1 to (count MyFoundWordss)
set myFoundTag to contents of item myCounter of MyFoundWordss
if myFoundTags does not contain myFoundTag then
copy myFoundTag to end of myFoundTags
end if
end repeat
end if
end if
repeat with k from 1 to count of myFoundTags
set myselectiona to item k of myFoundTags
if myselectiona is in myselect then
set contents of insertion point -1 of selection to myselectiona
end if
end repeat
end repeat
end repeat
end repeat
end if
end tell