InDesign Detect a Carriage Return

Using InDesign CS4.
Does anybody know of a way to determine if the last character of a given line of text within a given story is a “return” character?


I guess straightforward:

if last character of line 1 of story 1 of document 1 is return then

Wow, it is that straightforward. I didn’t realize “line” was an option. I was using “paragraph”. big difference :slight_smile:
Thank you Stefan

I just read the dictionary. Adobe apps have hugh dictionaries with a ton of classes

Yes they do Stefan, though I think if you are serious about developing for their apps you should investigate their javascript implementation which from what I can tell is a bit more robust if less intuitive, especially for quick development. I have been playing around with javascript with InDesign and Photoshop in the past few months and it is very robust, but if I need to do something fast I go to AppleScript. I also find AppleScript good for setting down a quick method and finding the properties I need quickly then converting them to javascript later.

this implies to be familiar with javascript. :wink:

More robust in what way?

As I understand it the javascript implementation in Adobe’s programs has an additional UI model (ScriptUI) in addition to that built into InDesign that seems to be a bit more powerful. Also with javascript and InDesign there is the ability to create menu items and using even listeners. I also seem to recall that there are additional methods to integrate your scrips into InDesign in a way that is similar to the plug-in model. You also have the added benefit that your javascripts are platform independent as long as you add in methods to handle the difference in file handling between Mac and Windows.

It does (it’s in the js implementation itself, not InDesign), but that hardly constitutes robustness.

As there is with InDesign and AppleScript; they are virtually identical in this respect.

With respect, I think you’re grasping at straws…

Well yes, but again, that’s hardly robustness. And against that, making it work with multiple apps is like having your nails pulled out, slowly.

There two have pros and cons, no doubt. But the idea of js somehow being more robust is wrong. If anything, its namespace/scripting engine issues make it less robust.

Jerome, I use both languages across the main suite apps AI, BR ID & PS. Each has it pros & cons. ScriptUI is pretty easy for building dialogs/palettes. JavaScript more robust? I don’t think so. Both are as robust as your syntax. The code may appear robust because it’s less flexible in it’s limited range of terms. You can certainly find yourself writing more to do the same. The Extended range of functions for working with the file system are a country mile behind what you can do with AppleScript. I find JavaScript is slightly faster processing due to NOT redrawing the screen. No harm in knowing enough of both and make the pros of both work for you. Rewriting AppleScript as JavaScript only do that for the journey and not the destination. ( unless destination is windoze oh no? )