(See below for my edits and updates. I didn’t want to reply to my own posts…)
Hi,
I’m new here, not new to applescript. I have worked with Quark XPress and applescript with good result some years ago but would like to start scripting Indesign.
I have the following:
I have a text which I can ‘find GREP’
I do however not want to do a ‘change GREP’ but I’d like to make a table with the found text and give it a certain width Height and stroke.
I know the convert to table method but I don’t know how to do this on the GREP I found.
I also don’t know how to set the width and Height of a table.
Any suggestions welcome and thanks in advance!
Oh, and I’d like to buy a good book. Any suggestions??
Edit:
Update.
I did manage to make a script to ‘do something’ with every table.
Now I have to find how to format the tables.
For some reason the “TableFormatting.applescript” as provided in the “indesign_cs5_scripting_guide_scripts” doesn’t work at all. It simply doesn’t want to format the tables it makes itself.
Here is the script I came up with to ‘do something’ to every table.
It is is perhaps not the best script but it works for now…
tell application "Adobe InDesign CS4"
if (count documents) > 0 then
if (count stories of active document) > 0 then
my myDisplayDialog()
else
display dialog "The active document contains no text. Please open a document containing text and try again."
end if
else
display dialog "No documents are open. Please open a document and try again."
end if
end tell
on myDisplayDialog()
end myDisplayDialog
tell application "Adobe InDesign CS4"
set myDocument to active document
repeat with myCounter from 1 to (count stories of myDocument)
set myStory to story myCounter of myDocument
tell every table of myStory
--here is where the formatting should take place
--do something ;)
end tell
end repeat
end tell
Edit2:
Ok, I’m confused now. Why doesn’t it even do: “set row type of row 1 to header row” when I put that in the '–do something" part of this script… in fact why doesn’t it work in the samplescripts provided by Adobe. Help!
I know I must be pointing at the tables in my document because when I say ‘delete’ is does delete all my tables. Meh, not something I want to do
Model: minimac
AppleScript: 2.1.2
Browser: Firefox 3.6.3
Operating System: Mac OS X (10.6)