(* Convert Message from DOS Thai to Unicode Converts the source of selected messages from Windows/DOS Thai text encoding to Unicode. Places the converted source into new notes, linked to the selected messages. *** REQUIRES THAT CYCLONE BE INSTALLED *** http://free.abracode.com/cyclone/Cyclone_X.dmg.gz *) 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 thaiSubject to subject of theMessage set thaiContent to content of theMessage set thaiSource to source of theMessage -- convert information from DOS Thai to Unicode and store it in variables if thaiSubject is not "" then set unicodeSubject to my ConvertWithCyclone1(thaiSubject) end if if thaiContent is not "" then set unicodeContent to my ConvertWithCyclone1(thaiContent) end if if thaiSource is not "" then set unicodeSource to my ConvertWithCyclone1(thaiSource) end if -- set the subject and content of the message to the converted values -- DOES NOT WORK PROPERLY --set subject of theMessage to unicodeSubject --set content of theMessage to unicodeContent --set source of theMessage to unicodeSource -- create a new note with the information from the message set newNote to make new note with properties {name:unicodeSubject, content:(unicodeSource)} -- create a link between the message and the new note link theMessage to newNote -- if there was only one message selected, then open that new note if (count of selectedMessages) = 1 then open newNote end repeat -- quit Cyclone tell application "Cyclone" quit end tell end tell on ConvertWithCyclone1(thai_text) tell application "Cyclone" try set unic_text to (convert text thai_text from DOS_Thai to "UTF-16") on error number the error_number error "An error occured during clipboard conversion." & return & "Error code: " & (error_number as text) end try end tell return unic_text end ConvertWithCyclone1