Unable to see values


(Chip Towner) #1

I have an AppleScript I am creating to operate on email messages and when I set several variable values in the script the inspector does not contain any of the variables I have set. I don’'t write scripts very often but I do not recall having this issue previously. Can anyone help me sort out why I can’t see these values?

For example:

using terms from application "Mail"
	on perform mail action with messages messageList in mailboxes mbox for rule aRule
		repeat with currentMessage in messageList
			try
				tell currentMessage
					set {theDateReceived, theDateSent, theSender, theSubject, theSource, theReadFlag, theContent} to {the date received, the date sent, the sender, subject, the source, the read status, the content}

In the above snippet none of the variables set are available in the inspector…

Thanks


(Mark Alldritt) #2

Local variables used within a handler need to be declared explicitly using a local varName statement:

local theDateReceived, theDateSent, theSender, theSubject, theSource, theReadFlag, theContent

This explained in greater detail in the Script Debugger help - search for variables.


(Chip Towner) #4

Mark,
Thanks very much!