Code in a variable?

Hello everyone,

I made a script that “makes” a line of code based on some variables on my server. So i want that script to execute that command in the script.

an example of what i’d like:

set command to "display dialog "Hello""
command

the “command” in the second line of the code should execute the code, but neither does the first line like to set command to display dialog “hello” nor dor command like to execute it…

I know of a complex and long way to bypass this but is there am easier way?

Thanks in forward.

Hi,

you can compile and run plain text with run script


set command to "display dialog \"Hello\""
run script command

Thank you! it worked!

is the " needed so it won’t recognize it as something to execute but just something to put in the variable eg if i want to put " in a variable i do this: “"” ?

if the source code is represented by a literal string, all occurrences of double quotes must be escaped with a backslash