I need help to make a charset aplescript for mail

Hi,

Can some one help me making a script that i can use in Mail rules to change the character set of an email?

Thank you in advance.
Yousuf

Example, please.
SC

Hi,

I’m not a scripter, but based on a tip from a friend i think it should be somthink like this


tell application "Mail"
	click menu item "Arabic (Windows)" of  menu "Text Encoding" of  menu "Message" of  process "Mail"
end tell


The thing is Script Editor never allowes me to save it.

Thanks in advance.
Yousuf

It looks like you are trying to script the Graphic User Interface (GUI), so here is a snippet from Apple from the above link:

This should work for you once you activate GUI scripting:
http://www.apple.com/applescript/uiscripting/01.html

tell application Mail
  activate
end tell
tell application "System Events"
tell process Mail
tell menu bar 1
tell menu bar item "Message"
tell menu "Text Encoding"
  click menu item  "Arabic (Windows)"
end tell
end tell
end tell
end tell
end tell
return true
on error error_message
return false

SC

ok, when i try to compile it i get “Expected function name, command name or function name but found “error”.”

and i compiled it like this


tell application Mail
	activate
end tell
tell application "System Events"
	tell process Mail
		tell menu bar 1
			tell menu bar item "Message"
				tell menu "Text Encoding"
					click menu item "Arabic (Windows)"
				end tell
			end tell
		end tell
	end tell
end tell

but stil didn’t work

And qafter many many tests i did


tell application "Mail"
	activate
end tell
tell application "System Events"
	tell process "Mail"
		tell menu bar 1
			tell menu bar item "Message"
				tell menu item "Text Encoding"
					click menu item "Arabic (Windows)"
				end tell
			end tell
		end tell
	end tell
end tell

but i get the error:
System Events got an error: NSReceiverEvaluationScriptError: 4

when i try to run it with the “click menu item “Arabic (Windows)”” selected.

Any idea?