Hi all,
I’m having a little trouble converting a Quark script to an InDesign CS2 script. I have a FileMaker Pro 8.5 database with a bunch of real estate listings and I need to put them into an InDesign document for proof reading. I have a template that has 1 text frame to access and to place every new listing into. My problem is getting the syntax to keep adding the new listing at the beginning of the text frame. I’m not very well versed in scripting and even less so with InDesign. Here’s what I have for code (sorry it’s a little long):
repeat with i from 1 to databaseCount
-- tries to place either the number of available positions or the number of found listings, whichever is smaller
-- repeat with i from 1 to databaseCount
tell application "FileMaker Pro"
tell document 1
tell record i
set houseList to (get cells 1 thru 9)
-- grabs all the cells of a record
set mlsNumber to item 1 of houseList
set openInfo to item 2 of houseList
set houseAddress to item 3 of houseList
set houseDirections to item 6 of houseList
set houseDescription to item 7 of houseList
set housePrice to item 8 of houseList
set realtorName to item 9 of houseList
end tell
end tell
end tell
tell application "Adobe InDesign CS2"
activate
tell story 1 of text frame 1 of page 1 of document 1
if houseDirections = "" then
make new text at beginning with properties {contents:return & houseAddress & return & openInfo & return & houseDescription & return & mlsNumber & tab & "$" & housePrice & tab & realtorName & return}
try
set applied paragraph style of paragraphs 1 thru 4 to "No style"
end try
set applied paragraph style of paragraph 1 to "No style"
set applied paragraph style of paragraph 2 to "Address"
set applied paragraph style of paragraph 3 to "Open Time"
set applied paragraph style of paragraph 4 to "Description w/o cap"
set applied paragraph style of paragraph 5 to "Realtor name and number"
try
search text frame ("Info" & i) for "*" replacing with tab
end try
else
make new text at beginning with properties {contents:return & houseAddress & return & openInfo & return & "(Dir: " & houseDirections & ")" & return & houseDescription & return & mlsNumber & tab & "$" & housePrice & tab & realtorName & return}
try
set applied paragraph style of paragraphs 1 thru 5 to "No style"
set applied paragraph style of paragraph 1 to "No style"
set applied paragraph style of paragraph 2 to "Address"
set applied paragraph style of paragraph 3 to "Open Time"
set applied paragraph style of paragraph 4 to "Directions"
set applied paragraph style of paragraph 5 to "Description w/o cap"
set applied paragraph style of paragraph 6 to "Realtor name and number"
end try
try
search text frame ("Info" & i) for "*" replacing with tab
end try
end if
end tell
end tell
end repeat
This is running on an Intel mac with OS 10.4.8. Any help will be appreciated. Thanks in advance.