Toad World® Forums

Run Automation Script using a variable for the script name

I am trying to create an automation that calls other automations based on some entries in a database table. This automation also runs other types of things like batch files, etc. This is basically so that all of these things will run sequentially to reduce contention for resources and give us flexibility to change what's run easily.

It does not seem to be possible to use the Run Automation Script activity with a variable for the Automation script parameter? It gives an immediate error if the entry does not end in TAS. I also tried a variable followed by ".TAS" and that got a little further but still failed.

Alternatively, I tried using the Run Program activity and calling the Automation the exact same way that it is called from the Windows Task Scheduler. That was actually successful, but generated a lot of odd error messages while the called automation was running. The errors were like "Run_TDP_TAS Error Message: line 2:30 required (...)+ loop did not match anything at character 'S'" which I cannot relate at all to the called automation and which don't seem to actually be errors since the called automation completed successfully.

So, hoping that someone can either instruct me on how to use a variable with the Run Automation Script activity or verify that it is not possible. And/or have any insights concerning the error messages generated when using Run Program to call an Automation.

Any help is greatly appreciated!

Additional Information: I think that the odd errors that I'm getting are when the called automation is writing to it's log maybe? When you call an automation using the Run Automation Script activity, the called automation writes to the parent automation's log, but calling an automation using Run Program, the called automation writes to it's own log, so I'm wondering if that has something to do with those errors.

I was able to create a workaround by using a dummy .TAS file in the Run Automation Script activity and adding a Copy File activity before that which copies the real TAS into the dummy TAS inside the loop. So far it seems to work, even with some complex automations.

Wish I would have caught this sooner... in some places TDP does not support variable references within file names, and I'm pretty sure this is one scenario that we don't support (yet).

Having said that, thanks for sharing with the Community your wonderful workaround. Most helpful.

Thanks, Gary. So will this functionality be added to a future release?

Wish I could tell you for certain, as I don't own the product... but I'll push for it as a user... I think there's viable use cases for variablizing file names within automation.

1 Like