Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

Applescript—Apply Character Style to Select Words in InDesign CC

$
0
0

I'm trying to apply a character style to the first several words of a paragraph. The number of words varies, but it is essentially every word before a comma.

 

 

Here's what I have so far:

 

 

tell application "Adobe InDesign CC 2014"

  tell document 1

  tell page 2

  tell (item 1 of page items whose label is "HabitsContent")

  tell paragraph 2

  repeat with i from 1 to count of characters

  if contents of character i = "," then

  exit repeat

  end if

  end repeat

  set applied character style of characters 1 thru i to "Italic"

  end tell

  end tell

  end tell

  end tell

end tell

 

 

Viewing the log of the script, it finds the comma; however, the script ends up italicizing the entire paragraph. Any ideas?


Viewing all articles
Browse latest Browse all 15932


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>