Is it possible to use variable's value as code in Script?

General discussions about Automagic and automation in general

Moderator: Martin

Post Reply
kamil_w
Posts: 50
Joined: 22 Oct 2013 19:01

Is it possible to use variable's value as code in Script?

Post by kamil_w » 21 Mar 2019 00:28

Hi,
I have a text in txtfile ready to be used as a code in action Script.

I copied that text to variable 'var_code' using action 'init variable text folder'.

Is there any way to use the value of that variable as code?

User avatar
Desmanto
Posts: 1873
Joined: 21 Jul 2017 17:50

Re: Is it possible to use variable's value as code in Scrip

Post by Desmanto » 21 Mar 2019 10:32

use eval()

Code: Select all

eval(var_code)
If you need to create a custom defined function, you can design it like this : viewtopic.php?f=5&t=7739
Just make sure your code is already tested before changing it to text.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190714, Pie 9.0, Rooted.

kamil_w
Posts: 50
Joined: 22 Oct 2013 19:01

Re: Is it possible to use variable's value as code in Scrip

Post by kamil_w » 21 Mar 2019 10:46

Awesome!
Thank you.

Post Reply