• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Emailing scripts for execution
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emailing scripts for execution


  • Subject: Re: Emailing scripts for execution
  • From: kai <email@hidden>
  • Date: Sun, 21 Aug 2005 23:19:39 +0100


On 19 Aug 2005, at 06:15, Rob Lewis wrote:

I have this fantasy about being able to email a script to my system and have it executed.

The idea would be to use a Mail rule to detect that the message text body contained a script to be executed, then do it.

Is this a pipe dream?

I believe that should be possible, Rob - simply by using another script to execute the mailed script.


First, save the following as a compiled script:

------------------

to runScript(scpt)
    run script scpt
end runScript

using terms from application "Mail"
    to perform mail action with messages msgList
        tell application "Mail" to repeat with msg in msgList
            my runScript(msg's content)
        end repeat
    end perform mail action with messages
end using terms from

------------------

If you intend the body of your email message to contain text other than a script (i.e. signatures, etc.), then you'll need to modify the above script to parse message content. However, for demonstration purposes, I've assumed that the message body will contain *only* a script (simply copied, say, from Script Editor - and pasted into an otherwise empty message).

Set up your Mail rule, satisfying yourself that it offers sufficient security (as others have already advised). Under "Perform the following actions:", select "Run AppleScript - and then choose the file that contains the above script.

Finally, send yourself a script in an email message that meets the rule's conditions.

---
kai


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Emailing scripts for execution
      • From: Michael Gmail <email@hidden>
References: 
 >Emailing scripts for execution (From: Rob Lewis <email@hidden>)

  • Prev by Date: Re: Finder f*ck-ups
  • Next by Date: on run, Expected a reference
  • Previous by thread: Re: Emailing scripts for execution
  • Next by thread: Re: Emailing scripts for execution
  • Index(es):
    • Date
    • Thread