# Images for a Whole Directory

**URL:** <https://discuss.avogadro.cc/t/images-for-a-whole-directory/4430>\
**Category:** Support\
**Created:** [April 8, 2023, 5:38pm UTC](https://discuss.avogadro.cc/t/images-for-a-whole-directory/4430 "2023-04-08T17:38:19Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![ghutchis](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/ghutchis/32/456_2.png) [@ghutchis](https://discuss.avogadro.cc/u/ghutchis)\
**Post date:** [April 11, 2023, 6:28pm UTC](https://discuss.avogadro.cc/t/images-for-a-whole-directory/4430/5 "2023-04-11T18:28:25Z")

</div>

As I brought up last summer ([Tasks for Automation](https://discuss.avogadro.cc/t/tasks-for-automation/3951)) the intent is certainly to have a set of scriptable commands.

Basically, you want something like:

```auto
from avogadro import sendMessage

for filename in glob.glob(*.xyz):
        path = cwd + "/" + filename
        sendMessage("openFile", path)
        sendMessage("selectElement", 1)
        sendMessage("showSelectedAtoms", False)
        sendMessage("saveGraphic", path[:-4] + ".png")

```

And yes, your point would be to select for example based on a SMARTS pattern.

---

_[View the full topic](https://discuss.avogadro.cc/t/images-for-a-whole-directory/4430)._
