Hi. I cobbled together a quick script to help automatically import/convert .dat files for use in Synfig. The code is fairly crude, but it seems to work. I have mine set up to import png files by default.
Basically, I take all the dat files and drop them into their own directory where I place the script. It first makes the changes to the files and then changes them to lst files. The changes are permanent, so you want to make sure you only run the script in the directory where you have the files stored. Anyway, here is the script (which I called datalst.py):
import os
import sys
import fileinput
import glob
for line in fileinput.input(glob.glob(’*.dat’), inplace=True):
sys.stdout.write(line.replace(‘MohoSwitch1’, ‘MohoSwitch1’ ‘\n’ ‘FPS 24’ ‘\n’ ‘png’))
for filename in os.listdir(os.path.dirname(os.path.abspath(file))):
base_file, ext = os.path.splitext(filename)
if ext == “.dat”:
os.rename(filename, base_file + “.lst”)
I am sure more experienced programmers could come up with a better method, but this is what I came up with. Feel free to use or modify it.
Update: The forum formatting seems a bit off, so here is a jpg file that shows the formatting.