# Script for Steve
```python
import pathlib
import random
import re
mouse_names = [
"mouse1",
"mouse2",
"mouse3",
]
random.seed(1985) # Seed the random number generator so we get the same "random" numbers each time
mouse_codes = {name: random.randint(100000, 999999) for name in mouse_names}
# mouse_codes = {
# "mouse1": 12345,
# "mouse2": 23456,
# "mouse3": 34567,
# }
cwd = Path(".")
for path in cwd.glob("2022*"):
# Grab contents of XML file
if not path.is_dir():
continue
filepath = path / "Series.vxml"
if not filepath.is_file():
raise FileNotFoundError("whoops")
with open(filepath, "r") as fh:
xml = fh.read()
# Determine name, replace with code
namematch = re.search(f'name="([^"]+)"', xml)
if not namematch:
raise ValueError(f"unable to determine name for {str(filepath)}")
name = namematch.group(1)
if name not in mouse_codes:
raise ValueError(f"no code for mouse {name}")
new_code = mouse_codes[name]
xml = re.sub(r'name="[^"]+"', f'name="{new_code}"', xml)
# Overwrite the XML file
with open(filepath, "w") as fh:
print(xml, end="", file=fh)
```