Load a text file that contain a script and run it.


I am trying to make an apple script that will load a text file that sits in the same folder. This file is plain text but is an applescript.

I am try to run the script like this :

run script (read "script.txt")

I am new to this, I get the the following error “Can’t make “script.txt” into type file.” any pointers?


read requires a full path to the file to be read.

With a text file called “HiThere.txt” on my desktop containing the single line: display dialog “Hi There!”, I run this script and the dialog box appears:

set myFile to ((path to desktop as text) & "HiThere.txt") as alias
run script (read myFile)


Thanks for the help I have it working now.