Supertool: run a set (batch) of scripts

Looks like Supertool is really popular tool with growing user scripts amount.

Personally me have several specific for me only checker-scripts which checks different things in my DB. For example I am going develop one additional checker which will check ukrainian names according to some official names’ lists.

The idea is run all such custom checkers “in one click” periodically, say every month.

If the Supertool author and other Gramps users think that this feature makes sense, it would be great to have such ability.

SuperTool has hooks for a running from the command line.

You can already write a batch file script for your monthly SuperTool maintenance tasks.

2 Likes

Its a good idea! I will try. Thank you!

1 Like

Some update if anybody needs the same as me.
I’ve created such simple checker.sh script

#!/bin/bash

# This script allows package running of different custom Gramps checkers 
# which are missing in the "Data Verify tool" addon.

# Get the current date and time
now=$(date +"%Y-%m-%d_%H-%M-%S")

echo "Run checker to verify Ukrainian first names"
gramps -O "Main Tree" -a tool -p name=SuperTool,script=scripts/checker_ua_name.script > "reports/checker_ua_name_${now}.log" 2>&1

echo "Run checker to verify a person Caste attribute"
gramps -O "Main Tree" -a tool -p name=SuperTool,script=scripts/checker_caste.script > "reports/checker_caste_${now}.log" 2>&1

echo "Run checker to verify twins attributes"
gramps -O "Main Tree" -a tool -p name=SuperTool,script=scripts/checker_twins.script > "reports/checker_twins_${now}.log" 2>&1

The “scripts” folder contains SuperTool scripts which should be run.
The “reports” folder gathers logs after the checker.sh running.

Running checker.sh (in Bourne Shell) under Ubuntu:
sh checker.sh

The same should work in Mac OS I think.
As for Windows I’m not sure. I believe something similar can be done with cmd scripts.

2 Likes

Linked this discussion from the “See Also” subsection in of the SuperTool wiki docs.

Batching of SuperTool scripts (with an emphasis on automating regular maintenance tasks) would be a good expansion to the SuperTool docs in the README.md#running-from-the-command-line subsection.

1 Like

@kku One more interesting feature could be to add possibility show and run some Supertool scripts directly in Gramps->…->My Scripts main menu. I mean not all scripts. This list should be configured from anywhere. So, I can create several important for me scripts and run them directly from main menu. That means - Gramps users can extend Gramps possibilities personally under their needs.

And there (from menu) we could also run batches - my dreams :cowboy_hat_face:

Gramps->…->My Scripts
Gramps->…->My Script Batches

I maintain a separate tree with a collection of Notes (with “SuperTool Script” type) attached to a Person (the person who created them, usually @kku or @PLegoux ). Each script’s description has a hotlink to where that script was shared. There is a ToDo type Note that that has a linked index to the scripts with brief descriptions. (This tree also has scripts for running in Python Eval or in the SQL tools.)

I can:

  1. switch to that tree
  2. undock the ToDo gramplet in the People category (make it big on my 2nd screen)
  3. flip through the People (which shows the script index in the ToDo gramplet) until I spot the right script. Remember the name of the script.
  4. open SuperTool in the appropriate category
  5. load the script from the Note
  6. reload the original Tree
  7. and, finally, Execute the script in SuperTool
1 Like

this is a very interesting approach! Do you save ALL scripts? Are they local ar public?

Yes, I am trying to go back and collect scripts. It is a sloooow process. Some are only useful as pseudocode reference. (I hate pseudocode snippets but still collect them.)

Each SuperTool Script is stored as “SuperTool Script” type Notes within that alternative Gramps Tree. I found saving them as external .script made it too easy to lose scripts. Also, there was no access to the Description nor organizational tools.

The other benefit to SuperTool Scripts as notes is that the Note Editor lets you look a more lines of code than SuperTool’s GUI.

1 Like

I am (trying to) work towards pausing my Gramps tasks because Real Life needs to take precedence. So I do not have time to spend on these tasks.

But such a collection is possible here in Discourse. Did you know that you can attach a .gramps file to postings?

Alternatively, you could coordinate with @kku … such a library for SuperTool is more appropriate to the Isotammi addons collection than the Gramps one. Maybe it could be a General Plugin lib type plugin? However, this is somewhat contrary to the “mission” of SuperTool to be an “ad hoc” database query tool

1 Like

Another trick for SuperTool…

My interest in a JSON parser started with the @kku SuperTool help file. helptext.json.

I was impressed by the flexibility of that help system and wanted to tweak it. As a novice (or skiddie), I needed more references and examples. (Like linking to the developer docs in Sphinx… or the sample SuperTool scripts. I can never find those at the drop of a hat.) So my SuperTool help has more tabs and more linked topics. Most won’t pass Kari’s litmus tests for consistency and accuracy. So my help variant won’t be rolled into the standard distribution.

If you’re a SuperTool user and haven’t adapted your helptext.json, you’re working too hard.

The only caveat to customizing is that every update to SuperTool… and its updates are more frequent than other addons… overwrites the customization. Frustrating.

So, a way to simplify reverting to my help customization was needed.

Another thing my SuperTool script collection in a Gramps tree has is: the SuperTool addon 's help file linked as a Media Object in the Gramps User Directory and a copy of my customized help as a Note for that Media object. Now when the update installs, it overwrites the linked media object… but the link persists.

Thus, I can switch to that SuperTool Tree, open that helptext.json file in the Media category, double click to edit (had to change the default OS association of .json from a browser to a text editor), open the Note, then copy the contents of the Note to the OS clipboard, then paste into the JSON and save it.

(Actually, since the Ctrl+c keybinding is mapped to copying to the Gramps clipboard, I use Crtl+a select all, Ctrl+x cut, Cancel in the Note Editor then Crtl+a select all, Crtl+v paste, Crtl+s save in the JSON text editor.)