Hi,
Been beating my brains trying to script Word 2008 with Unicode. Inside a tell application "Microsoft Word’ block it doesn’t seem to understand either the ‘id’ or ‘character id’. (error is ‘Can’t get id of xx’. I tried putting the code in a separate tell me function, but the script barks “Microsoft Word got an error: active document doesn’t understand the getCode message.”
Am I realizing that Word 2008 doesn’t support unicode for Applescript? Any workarounds? I need to get the unicode codepoints for evaluation and write out characters with ‘character id’.
Thx for any insight. Stumped in Montanaland
Fred
Here’s a short example. The Tell Me works, but the Tell Word doesn’t. Thoughts?
– This works
tell me
set myVal to “A”
getCode(“A”)
end tell
– This doesn’t
tell application “Microsoft Word”
activate
set myVal to “A”
getCode(“A”)
end tell
on getCode(myVal)
tell me
return id of myVal as integer
end tell
end getCode
Wnen calling method from inside a tell block the MY keyword should be used
tell application "Microsoft Word"
activate
set myVal to "A"
my getCode("A") -- <<<<<<<<<<<<<<<
end tell
on getCode(myVal)
return id of myVal as integer
end getCode
Thanks for the hint…it worked. I’m still slugging through the basics of Applescript after a long hiatus.
Any idea how to use get the id inside the Tell Word block? I saw a few other posts (not Word) where people mentioned they have to use a function outside a tell application block to get the id.
Thx again,
You might use ASCII character
tell application "Microsoft Word"
ASCII character 65
end tell