cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

How to "force" the user to run context checker before closing a document?

kregimbald
12-Amethyst

How to "force" the user to run context checker before closing a document?

We would like to ensure that "check completeness" is run on content before AE is closed. Is there a way to do this? Is there anything we should be aware of that could cause issues when implementing this? We would still like the option to turn off this functionality when required.

5 REPLIES 5

You can start by ensuring that "reportinvalidmarkup" is set to "on" in Arbortext Editor's advance preferences. This will ensure the "Check Completeness" is on when the file is opened and will report issues if found. Then, you can overload the close document event to automatically run "Check Completeness" upon document close. Refer to the ACL Reference manual "check_completeness" command. You might also want to look at the "doc_incomplete" command.

That's all I can offer. I'm still quite new to the Arbortext Editor development environment.


Hi Kathleen,

Was Timothy's answer helpful to you? Did you have any more questions on this?

Thanks!

kregimbald
12-Amethyst
(To:rdiaz)

We haven't had a chance to try out his suggestion. I'll update here within the next few days.

pnagai
12-Amethyst
(To:kregimbald)

In order to perform a check when a document is closed, you will want to look into one or both of the following:

session_add_callback. Look at "quit".

doc_add_callback. Look at "destroy".

I use both.

When you launch the application or open the document you will want to add the callback(s). Here's one example of a doc close callback (the ACL callback is named "destroy" because DRAMA! LOL!). I usually store these in the editinit subfolder of the custom folder.

doc_add_callback($doc, "destroy", "yourpackage::yourfunction")

You will have to have created the package and function of course. You will probably store it in the scripts subfolder of the custom folder.

Code:

= = = = = = = = = = = =

package yourpackage

function yourfunction (doc, op) {

if ($op == 1) {

return 0

} # end if

# do something with $doc here ...

# like check completeness or something else ...

} # end function

= = = = = = = = = = = =

Callbacks are called twice in succession. The test on $op == 1 (the first pass) can be used to execute the action or not depending on whatever you like by returning 0 or 1, respectively.

Typed by hand so check yourself for typos.

kregimbald
12-Amethyst
(To:pnagai)

Probably won't get around to trying this for a bit...will let you know if it works. Thanks

Announcements

Top Tags