okay… this is bizarre
I have the script that is supposed to retrieve a word that I am looking at on Merriam-Webster’s Online dictionary and store it in a Microsoft word document. But it runs into a problem whenever i try to enter that word in the document.
global theWord
-- This process retrieves the word
tell application "Safari"
set bigString to URL of front document
end tell
if bigString contains "&" then
set text item delimiters to "="
set L to text items of bigString
set wordItem to item 3 of L
set text item delimiters to "&"
set theWord to text item 1 of wordItem
else
set text item delimiters to "="
set L to text items of bigString
set theWord to last text item of bigString
end if
-- Now that word is stored in a Microsoft word document
set thePath to "Macintosh HD:Users:h3ss2:Documents:Vocab.doc" as alias
tell application "Microsoft Word"
if name of documents does not contain (thePath as string) then
open thePath
end if
--here's the problem tell block
tell text of window "Vocab.doc"
set contents of insertion point after last word to (return & theWord)
end tell
--save front document in alias thePath
end tell
When i try and set the variable theWord to a literal string in the top level it inserts the word just fine. But for some reason it won’t work with the word that i pull from the URL. It’s not a class issue. HELP! WHAT’S GOING ON!!!