# Run Automation Script using a variable for the script name

**URL:** <https://forums.toadworld.com/t/run-automation-script-using-a-variable-for-the-script-name/50785>\
**Category:** Toad Data Point & Toad Intelligence Central\
**Created:** [August 26, 2020, 6:19pm UTC](https://forums.toadworld.com/t/run-automation-script-using-a-variable-for-the-script-name/50785 "2020-08-26T18:19:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mharper5](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/mharper5/32/12709_2.png) [@mharper5](https://forums.toadworld.com/u/mharper5)\
**Post date:** [August 26, 2020, 6:19pm UTC](https://forums.toadworld.com/t/run-automation-script-using-a-variable-for-the-script-name/50785/1 "2020-08-26T18:19:47Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![mharper5](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/mharper5/32/12709_2.png) [@mharper5](https://forums.toadworld.com/u/mharper5)\
**Post date:** [August 26, 2020, 7:18pm UTC](https://forums.toadworld.com/t/run-automation-script-using-a-variable-for-the-script-name/50785/2 "2020-08-26T19:18:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mharper5](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/mharper5/32/12709_2.png) [@mharper5](https://forums.toadworld.com/u/mharper5)\
**Post date:** [August 27, 2020, 6:45pm UTC](https://forums.toadworld.com/t/run-automation-script-using-a-variable-for-the-script-name/50785/3 "2020-08-27T18:45:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Gary.Jerep](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/gary.jerep/32/205_2.png) [@Gary.Jerep](https://forums.toadworld.com/u/Gary.Jerep)\
**Post date:** [September 3, 2020, 10:04pm UTC](https://forums.toadworld.com/t/run-automation-script-using-a-variable-for-the-script-name/50785/4 "2020-09-03T22:04:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mharper5](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/mharper5/32/12709_2.png) [@mharper5](https://forums.toadworld.com/u/mharper5)\
**Post date:** [September 4, 2020, 1:03pm UTC](https://forums.toadworld.com/t/run-automation-script-using-a-variable-for-the-script-name/50785/5 "2020-09-04T13:03:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Gary.Jerep](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/gary.jerep/32/205_2.png) [@Gary.Jerep](https://forums.toadworld.com/u/Gary.Jerep)\
**Post date:** [September 4, 2020, 3:31pm UTC](https://forums.toadworld.com/t/run-automation-script-using-a-variable-for-the-script-name/50785/6 "2020-09-04T15:31:56Z")

</div>

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.
