Applescript error -1700 type item when open file
I am trying to write an AppleScript that will open my Bookmarks from Safari using TextEdit and then do a find and replace for domains that have changed. I have over 2000 of them.
I want to write the AppleScript where if someone else wants to use the same script they can. So I am trying to use variable for path. When I run the AppleScript I get error below.
set userHome to (text of word -1 of (path to home folder as text))
tell application "Finder"
open (userHome & ":Library:Safari:Bookmarks.plist")
tell application "TextEdit" to activate
tell application "System Events" to tell process "TextEdit"
keystroke "f" usingcommand down & option down
keystroketabusingshift down
keystroke "Find this Text" & tab & "Replace with this Text"
delay 0.5
tell front window
clickbutton "All" of group 2 of scroll area 1
delay 0.5
clickbutton "Done" of scroll area 1
end tell
end tell
end tell
AppleScript Safari-OTHER, OS X Mountain Lion (10.8.1)