Jump to content

Setting Variables to Full-Code Segments


cloneryan02
 Share

1 post in this topic

Recommended Posts

So i've been trying to refine my code, and I wanted to do this,

set recipientName to "Me"
set recipientAddress to "cloneryan61002@gmail.com"
set theSubject to "Type your subject here!"
set theContent to "Type your message content here!"

(*This will send the message.*)
set codeSet2 to (tell application "Mail"

        ##Create the message
        set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}

        ##Set a recipient
        tell theMessage
                make new to recipient with properties {name:recipientName, address:recipientAddress}

                ##Send the Message
                send

        end tell
end tell)

I just typed up this code, but I can't the chunk of code into a variable (codeSet1)

I want it in a variable so it's easier to manipulate, so if I change one thing, it basically changes it once, instead of the twenty times it takes to retype everything.

Does anyone know how to turn this code into a variable?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...