# Additional processing on file open

**URL:** https://discourse.paraview.org/t/additional-processing-on-file-open/4610
**Category:** ParaView Support
**Tags:** python
**Created:** [June 17, 2020, 8:20pm UTC](https://discourse.paraview.org/t/additional-processing-on-file-open/4610 "2020-06-17T20:20:04Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ju-kreber](https://discourse.paraview.org/user_avatar/discourse.paraview.org/ju-kreber/32/4083_2.png) [@ju-kreber](https://discourse.paraview.org/u/ju-kreber)
#### Post date: [June 17, 2020, 8:20pm UTC](https://discourse.paraview.org/t/additional-processing-on-file-open/4610/1 "2020-06-17T20:20:05Z")

</div>

Hello,

I am searching for a way to achieve the following: I have some `vtmb` files that, once I open them in Paraview, need some additional processing like applying several filters. The way I’m handling this currently is via a small Python script as macro. However, it would be great if the script was executed automatically once the file is opened. So I was wondering if there is some event system or something similar that could trigger script execution on file opening?  
A different idea would be to write a small custom reader in Python (using `VTKPythonAlgorithmBase`) that wraps the usual VTK reader and takes care of the additional processing by itself. Here, my question would be if the custom reader would take precedence over the default reader if I register it for the `vtmb` extension?

Thanks in advance!

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [June 18, 2020, 7:40am UTC](https://discourse.paraview.org/t/additional-processing-on-file-open/4610/2 "2020-06-18T07:40:48Z")

</div>

> [@ju-kreber](#):
>
> So I was wondering if there is some event system or something similar that could trigger script execution on file opening?

Not really, but you could create a CustomFilter en-capsuling the reader and the processing. Not sure it will let you change the file though.

> Here, my question would be if the custom reader would take precedence over the default reader if I register it for the `vtmb` extension?

It will let you choose between versions.

---

<div class="post-metadata">

### Author: ![ju-kreber](https://discourse.paraview.org/user_avatar/discourse.paraview.org/ju-kreber/32/4083_2.png) [@ju-kreber](https://discourse.paraview.org/u/ju-kreber)
#### Post date: [June 28, 2020, 6:22pm UTC](https://discourse.paraview.org/t/additional-processing-on-file-open/4610/3 "2020-06-28T18:22:56Z")

</div>

Thank you very much for the information. The custom reader seems to work fine!
