Entourage and AppleScript

Hi, I’m a newcomer to this scripting business, so go easy…
For various reasons, I’ve adapted one of the included entourage scripts, so that a whole load of emails can be attached to the calendar as events in date order, with the subject as the title of the event, the start time of the event as the received time of the email and the sender address as the location. However, just using the command ‘sender’ gives Japanese/chinese symbols as the address. I know I need to insert some code somewhere to tell it what type of data the address is, but I’m not sure.

Can anyone help so that the address displays as ‘alan@shearer.com’ or something similar?

Cheers

My script so far:

tell application “Microsoft Entourage”

-- get the currently selected message or messages
set selectedMessages to current messages

-- if there are no messages selected, warn the user and then quit
if selectedMessages is {} then
	display dialog "Please select a message first and then run this script." with icon 1
	return
end if

repeat with theMessage in selectedMessages
	
	-- get the information from the message, and store it in variables
	
	set theContent to content of theMessage
	set theSubject to subject of theMessage
	set thestart to time received of theMessage
	set theSender to sender of theMessage
	
	
	-- create a new note with the information from the message
	set newEvent to make new event with properties {subject:theSubject, content:theContent, start time:thestart, location:address theSender}
	
	
	
	-- create a link between the message and the new note
	link theMessage to newEvent
	
	
end repeat

end tell
beep

You’re very close. The sender returns a record with “address” and “display name” properties so all you need to do is to use “address of sender”. You can set all the variables at once using the following code:

tell application "Microsoft Entourage"
	
	-- get the currently selected message or messages
	set selectedMessages to current messages
	
	-- if there are no messages selected, warn the user and then quit
	if selectedMessages is {} then
		display dialog "Please select a message first and then run this script." buttons {"OK"} default button 1 with icon 2 giving up after 10
		return
	end if
	
	repeat with theMessage in selectedMessages
		
		-- get the information from the message, and store it in variables
		tell theMessage to set {theContent, theSubject, thestart, theSender} to {content, subject, time received, address of sender}
		
		-- create a new note with the information from the message
		set newEvent to make new event with properties {subject:theSubject, content:theContent, start time:thestart, location:theSender}
		
		-- create a link between the message and the new note
		link theMessage to newEvent
		
	end repeat
end tell
beep

Jon