I hesitated to provide that hint, as I knew it wouldn't be enough, but also didn't know your path names, nor file names (nor filename template).
You can use filename(,0) to yield the file's name without the extension. The Rename tool will add it back. So:
mid(filename(,0),0,30)
is approximately what you want for the Filename portion (maybe you'll want < 30 chars though).