Hi! I would like to know how is it possible to run a Script from a text file. For example, I send to my Computer a message contains a body like "say “MacScripter” ". When the message is received, a script reads the body message and compile it and execute it. It would be a cool idea to control my computer via E-mail. My idea is:
- receiving the message, a script convert it in the text file (see in this forum how to do it)
- the same script compile the text file and execute it (Here I dont’t really know how I can do it).
Any idea?
Alex
profesoralex@yahoo.es
I’m not sure controlling your machine via email is a particularly secure thing but you can use rules to launch an applescript. This script could extract the email message body and then run it as another applescript.
Do you know what is the script to extract the message body and execute it? thanks in advance!
Alex
There should be a sample script in your Script editor folder that shows how to extract the message body. Once you have that part working, you can write the results to a file and then run it.
I can’t find any script to extract the body message. Do you know any resource? Thanks!
Applications:Applescript:Example Scripts:Mail Scripts:Scripts Menu:Get Source of Selected Message.scpt
You can also script Script Editor itself. Just open up the dictionary for Script Editor to get the commands. It would go something like this:
tell application "Script Editor"
set doc to make new document
set text of doc to "INSERT YOUR SCRIPT TEXT HERE"
compile doc
execute doc
set name of doc to "Script001" --When using variable instead of [document 1], put this command last in the chain
end tell
The script would then be open in the script editor with the name Script001. You could then put in a few more lines to save it or trash it.
Thanks, casdvm! Yor script is simply the best! It works perfectly! Thaks again!
Alex