D'oh-plicate terminology
D'oh-plicate terminology
- Subject: D'oh-plicate terminology
- From: Matt Deatherage <email@hidden>
- Date: Tue, 18 Nov 2003 01:11:01 -0600
[First time caller, but I'm a big fan of the archives.]
The following script has worked for years in InDesign 2.0.2:
tell application "InDesign 2.0.2"
tell active document
search story for "text" with find attributes B,
{applied paragraph style:"style name"}
end tell
end tell
This is an important part of our daily workflow as it's part of a script that reformats incoming Microsoft Word files.
Now, change "InDesign 2.0.2" to "InDesign CS" and, every time, you get:
>
InDesign CS got an error: story doesn't understand the search message.
I may be wandering in the weeds because I'm hopped up on cold medicine, but after some investigation, I find that InDesign CS has _three_ separate "search" events:
B+event K2 FindB; From Basics suite, only for application and document
objects
B+event K2TBFindB; From Tables suite, for cell, table, column, and row
B+event TeXTFindB; For text, character, word, line, text column,
paragraph, text style range, insertion point,
text frame, story, text path
The last one is the one I want, but no matter how I type it, including pasting in the raw event codes, AppleScript changes it to the first one (K2 /Find), and it always fails because that event can't search a story.
I'd been led to believe there is some kind of bizarre tell block terminology I can use to specify which "search" I want, but I can't figure it out. "Tell story" fails, as does "set myStory to parent of selection/tell myStory". The Apple event log continues to show the script using the (K2 /Find) event instead of the (TeXT/Find) event.
Now, I know InDesign computes its terminology on the fly from plug-ins, but the amount of duplicate terminology in this program is astounding:
add path - 3
bring forward - 3
bring to front - 4
create outlines - 2
exclude overlap path - 3
export - 6 (!)
fit - 3
import XML - 2
intersect path - 3
make compound path - 3
markup - 4
merge - 3
minus back - 3
override -3
package - 2
package for GoLive - 2
place - 3
place XML - 4
release compound path - 3
remove override - 3
replace - 2
reset scaling - 3
resize - 3
rotate - 3
search - 3
select - 6 (! again)
send backward - 3
send to back - 3
shear - 3
store - 4
subtract path - 4
unlink - 4
update - 2
I didn't even get into objects. As far as I can tell, each of these duplicate event terms has a different Apple event code, probably from the part of InDesign that added it to the dictionary on the fly.
So my first thought is that this must be a horrible, horrible, horrible bug that renders InDesign scripting mostly useless as you can never guarantee which event you'll get by typing a command. My second thought is that this can't be true, because every InDesign CS user who scripts anything would be screaming bloody murder about it, and that doesn't seem to be happening.
But either way, a simple search for paragraphs that match a given paragraph style - a core feature of InDesign 2's scripting capability - doesn't seem to work in InDesign CS because it's using the wrong event, and I can't figure out how to make it stop doing that, or how to make it work at all.
Any pointers or explanations are appreciated, including an idea about whether I'm just daft thinking that six different event codes for "export" or "select" is a really bad idea.
--
Matt Deatherage <email@hidden> <
http://www.macjournals.com>
I read this list in digest mode; copy me privately for faster responses
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.