Executing a variable as a statement

This must be simple, but I can’t figure it out after hours:

I have this snip in an AppleScript that runs okay to this point"

Tell application "Intaglio"
... do stuff that works okay ...
set pathInfo to "make new path with properties" & pathInfo as string
-- HERE I want to execute the value of pathInfo as a statement
end tell

When I take the value in pathInfo and paste it into a TELL block as a statement, I get a running AppleScript, but the idea is that based on user input, I construct the statement and execute it from within the AppleScript. I’ve been searching for how to do this for hours and nothing has worked.:frowning:

Here it is pasting the value of pathInfo into an applescript that works perfectly:

tell application "Intaglio"
	make new path with properties {segments:{move to, {200, 150}, line to, {185.3, 179.8}, line to, {152.4, 184.5}, line to, {176.2, 207.7}, line to, {170.6, 240.5}, line to, {200.0, 225.0}, line to, {229.4, 240.5}, line to, {223.8, 207.7}, line to, {247.6, 184.5}, line to, {214.7, 179.8}, line to, {200.0, 150.0}, close path}}
end tell

Thanks in advance for your help.:slight_smile:

You can run AppleScript code stored in a string by using the run script command.

When run, this code would emulate your manual copy/paste-in-tell-block/run operation:

run script "tell app \"Intaglio\"" & return & pathInfo & return & "end"

Model: iBook G4 933
AppleScript: 1.10.7
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

I have been breaking my head for hours, trying differnt things and searching through all the bowels of AppleScript hell, and NOWHERE did I find the simple “run script” command even mentioned. (I was trying do script and everything else I could think of; even making hiddeous constructs to pass a parameter)

run script & pathinfo

just this simple, and it worked, and now my script is about finished.

:slight_smile: BLESS YOU!!! :slight_smile: and I hope you win the lottery!!!


FYI, run script is part of StandardAdditions.