Skip to main content
rombanks
Inspiring
January 26, 2014
Question

Associating a condition with a paragraph/char format

  • January 26, 2014
  • 1 reply
  • 1599 views

Hello fellows,

I wonder if there is a way to automatically apply a certain condition to a specific type of a paragraph/character thru an event script.

Thank you in advance!

This topic has been closed for replies.

1 reply

frameexpert
Community Expert
Community Expert
January 26, 2014

Your best bet is to follow the advice I posted on my blog:

http://frameautomation.com/run-a-script-in-response-to-a-command/

Install the "test" event script that will display an integer whenever you perform a function. Try applying paragraph formats in various ways and see if you get a consistent number. If you do, you can modify the event script to test for that particular function number. Then, when that number is triggered, test the paragraph format of the current paragraph and apply the appropriate condition format. If you detect a different format, you may want to call a function that will remove the condition format if it is applied. Please let me know if this is not clear. Thanks.

Rick

www.frameexpert.com
rombanks
rombanksAuthor
Inspiring
January 27, 2014

Hi Rick,

Thank you very much for your response! Unfortunately, when applying a Pgf format, I am getting a well-known error - [object InvalidObject].

Please, advise!

My best regards,

Roman

frameexpert
Community Expert
Community Expert
January 27, 2014

Hi Roman, OK, here is a way you might be able to work around this. It is going to take more code, but it should work. Remember that with many events, there is a "Pre" event that corresponds to the "Post" event. So you could monitor the "Pre" side of the function event (FA_Note_PreFunction) and store the paragraph format of the current paragraph. Then when the FA_NotePostFunction event is triggered, again test the paragraph format of the current paragraph. If it has changed, then you know that a paragraph format has been applied. Then you can apply your condition.

A couple of notes: You will have to store the paragraph format name in a global variable so that it will still be available when the Post event is triggered. Also, this type of script will be "expensive" because it will get executed regardless of the function that is invoked. In practice, though, you may not notice any performance degredation. Please let me know if you have any questions or comments.

Rick

www.frameexpert.com