Insert a space before the paragraph in Indesign using GREP

First time using GREP in InDesign and a bit confused.

I want to find a specific paragraph style in InDesign and insert a space at the beginning of the paragraph. The GREP symbol for the beginning of the paragraph is ^. This is the closest I’ve gotten, but it won’t move the insertion point to the beginning of the paragraph. It just puts a space wherever the insertion point currently is. Need help.

tell application "Adobe InDesign CS4"
	set mydoc to active document
	set {find grep preferences, change grep preferences, find change grep options} to {nothing, nothing, nothing}
	set applied paragraph style of find grep preferences to "body_dropcap" -- the paragraph style in question
	set find what of find grep preferences to "^" -- GREP symbol for beginning of paragraph
	tell mydoc
		find grep
		set contents of selection to " "
	end tell
end tell

Hi,

you’ll need “change to & change grep”

tested with ID 5.5

tell application "Adobe InDesign CS5.5"
	set mydoc to active document
	set {find grep preferences, change grep preferences, find change grep options} to {nothing, nothing, nothing}
	set applied paragraph style of find grep preferences to "Test" -- the paragraph style in question
	set find what of find grep preferences to "^[^\\s]" -- GREP symbol for beginning of paragraph not followed by any kind of space
	set change to of change grep preferences to "\\s$0"
	tell mydoc
		find grep
		change grep
	end tell
end tell

hope it’ll work :slight_smile:

Glorious! It worked! I would have never figured out those arcane instructions.