Hi everyone,
I need some help trying to script a GREP serach.
This is what I have:
tell application "Adobe InDesign CS3"
activate
set myDocument to open "Marcus:Working Folder:Griffith Uni:GriffithTemplate.indd"
tell page 1 of myDocument
set myStory to place "Marcus:Working Folder:Griffith Uni:04-brown.doc" place point {18, 24} with autoflowing without showing options
end tell
tell active document
set applied master of page 1 to master spread "B-One Colomn Head"
--set text frame {18, 24, 63.085, 36.75}
end tell
tell myDocument
set colBody to paragraph style "* One Colomn Body" -- get a reference
set colBody1 to paragraph style "* 1 Section sub head"
set colBody2 to paragraph style "* 1 Section sub sub head"
set colBody3 to paragraph style "* One Colomn Main"
set colBody4 to paragraph style "* One Colomn FirstPara "
set colBody5 to paragraph style "* One Colomn Drop"
tell parent story of text frame 1 of page 1
set applied paragraph style to colBody
set applied paragraph style of paragraph 1 to colBody1
set applied paragraph style of paragraph 2 to colBody2
set applied paragraph style of paragraph 3 to colBody1
set applied paragraph style of paragraph 4 to colBody2
set applied paragraph style of paragraph 5 to colBody3
set applied paragraph style of paragraph 6 to colBody4
end tell
end tell
tell application "Adobe InDesign CS3"
set find grep preferences to nothing
set change grep preferences to nothing
set find what of find grep preferences to "(^.)"
set applied paragraph style of find grep preferences to colBody3
set change to of change grep preferences to "~P~P$0"
tell document 1
change grep
end tell
set find grep preferences to nothing
set change grep preferences to nothing
end tell
tell active document
set applied master of page 2 to master spread "E-BlankPage"
end tell
tell application "Adobe InDesign CS3"
set find grep preferences to nothing
set change grep preferences to nothing
set find what of find grep preferences to "\r\r.*\r"
set change to of change grep preferences to ""
set applied paragraph style of change grep preferences to colBody5
tell document 1
change grep
end tell
set find grep preferences to nothing
set change grep preferences to nothing
end tell
tell application "Adobe InDesign CS3"
set find grep preferences to nothing
set change grep preferences to nothing
set find what of find grep preferences to "^.*\r\r"
set applied paragraph style of find grep preferences to colBody5
set change to of change grep preferences to ""
set applied paragraph style of change grep preferences to colBody
tell document 1
change grep
end tell
set find grep preferences to nothing
set change grep preferences to nothing
end tell
-- tell application "Adobe InDesign CS3"
-- set find text preferences to nothing
-- set change text preferences to nothing
-- set find what of find text preferences to "^p^p"
-- set applied paragraph style of find text preferences to colBody
-- set change to of change grep preferences to "^p"
-- tell document 1
-- change text
-- end tell
-- set find text preferences to nothing
-- set change text preferences to nothing
-- end tell
end tell
But what I am looking for after it applied the E-Master page
is to search for empty paragraphs (return) and then apply a Paragraph style to the next paragraph after the line space return:
This is what I have now.
Text paragraph
Text paragraph
return
Text Paragraph
This ia what I want
Text paragraph
Text paragraph
return
Text Paragraph but with the new Paragraph Style.
Is is quietly doing my head in…
Thanks Marcus