Skip to main content
Participating Frequently
August 25, 2014
Question

Is it possible to run the script every time i select a TextFrame

  • August 25, 2014
  • 1 reply
  • 585 views

Hi all,

I am new to JavaScripting and i have a question and problem. I have a set of linked text frames, what i need is when the user click to select any text frame, the script automatically initiated and  select all Linked text frames. Is it Possible to do ??? and if Yes how can i do that.

Thanks in advance,

This topic has been closed for replies.

1 reply

Community Expert
August 25, 2014

@Mohamed – to write a script, that can react to the selection of a text frame is possible.
That would be an event driven script that uses an eventlistener that reacts on an afterSelectionChanged event.


To select all threaded text frames (containers) of a story is only possible for the ones on a single spread.
Any user selection of page items can only be spread wise. Opposed to text where you can select the whole story with the text tool that can span several spreads.

On the other hand: To do something to all threaded text frames (containers) of a story (without selecting them) is possible, if you provide your own user interface where the user has to interact with or let the script work in the background totally automatically.

What likes the user to do after "all" possible text frames of a story are selected or reached?

Uwe

Participating Frequently
August 25, 2014

Laubender, It's great to hear that it possible to do, but can you refer me to a documentation or any thread to learn how to write an eventlistener.

Community Expert
August 25, 2014

@Mohamed – before doing anything with an eventlistening process or writing some code or suggesting something, I have to know the whole story (still not answered for me):

Your idea is: Select all text frames of a story every time a text frame is selected.

Is that a good thing for the user? If I would work in such an environment, this would get to my nerves.

I said (and hopefully made that clear): Not possible in one go, if the text frames populate different spreads of the document. So a new question would arise immediately: What should happen in that case?

And also:

Should the user be able to start the process?

Should the user be able to stop the process?

What likes the user to happen automatically to all containers of a story in the moment a text frame is selected?

Just one thing this time? A different thing the next time?

Writing event driven scripts is not the easiest task. And it is very time consuming when it comes to testing things.

So I could only hint to the following: Search this very forum for "eventListeners" and read thoroughly before attempting anything.


Without answering the questions above (and following ones that will arise from your answers) it's impossible to give good advice.

Uwe